my code for longest common pattern(Problem code: LCPESY)......it is showing TLE..plz plz any one help 4 dat..........

//#include
#include<string.h>
//#include<math.h>
#include<stdio.h>
//using namespace std;

int main()
{
char a[10000],b[10000];
//int rslt[100];
int t;
//cin>>t;
scanf("%d",&t);
//copy=t;
while(t>0)
{
int flag=0;
//cin>>a>>b;
scanf("%s",&a);
scanf("%s",&b);
for(int i=0;i<strlen(a);i++)
{
for(int j=0;j<strlen(b);j++)
{
if(a[i]==b[j]){
flag++;
b[j]=‘1’;
break;
}
}
}
//cout<<flag;
printf("%d",flag);
//rslt[t]=flag;
t–;
}
// for(int i=copy;i>0;i–)
//{
// cout<<rslt[i]<<"\n";
//}
}

Request you to continue the discussion on the editorial page of the problem. Closing this question as of now.