dischar-nov14

i am getting all my test cases right bt really cant understand y it shows wrong answer here… here is my code-
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
main()
{
int t;
scanf("%d",&t);
while(t–){
char c[100001],ar[100001];int l,i,j,pos=-1,cnt=1,cur=1,max=1,x;
scanf("%s",c);fflush(stdin);
ar[0]=c[0];
l=strlen©;
for(i=1;i<l;i++)
{
x=0;
for(j=pos+1;j<cnt;j++)
{
if(c[i]!=ar[j])
x++;
else if(c[i]==ar[j])
pos=j;
}
if(x==cnt)
{
ar[cnt++]=c[i];
cur=cnt;
}
else
{
ar[cnt++]=c[i];
if(cur<cnt-(pos+1))
{
cur=cnt-(pos+1);
}
}
if(max<cur)
{
max=cur;
}
}
printf("%d\n",max);
}
}

@r1s09: I deleted the question before - you are not allowed to ask for help during the contest!