http://discuss.codechef.com/problems/ERROR
#include<stdio.h>
#include<string.h>
int main()
{
int i,t;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
int len,j,k,l,flag=0,count1=0,count2=0,count3=0;;
char num1[100001];
char num2[3];
char sample1[3]={‘1’, ‘0’, ‘1’};
char sample2[3]={‘0’, ‘1’, ‘0’};
scanf("%s", num1);
len=strlen(num1);
for(j=0;j<len-2;j++)
{
for(k=j;k<=j+2;k++)
{
num2[count1]=num1[k];
count1++;
}
for(l=0;l<3;l++)
{
if(num2[l]==sample1[l])
count2+=1;
}
for(l=0;l<3;l++)
{
if(num2[l]==sample2[l])
count3+=1;
}
if(count2==3)
{
flag=1;
break;
}
else if(count2==3)
{
flag=2;
break;
}
count1=0,count2=0,count3=0;
}
if(flag==1 || flag==2)
printf("GOOD");
else
printf("BAD");
printf("\n");
}
return 0;
}