I HAVE IMPLEMENTED MY CODE IN DEV C++ AND ALSO ONLINE IDE.IT IS WORKING WELL THERE BUT ON CODE CHEF IT IS SHOWING RUN TIME ERROR .TELL THE WAYS WHAT TO DO.
#include<stdio.h>
#include<math.h>
int main(){
int n,i,g=0;
char f[10];
char b[10];
int check[10];
//int lol=0;
scanf("%d",&n);
//printf("\n");
if(n>0 && n<20000){
for(i=0;i<n;i++){
int j,t=0,k=0,h=0,countb=0,counto=0,lol=0,bhoo=0;
int a[5] = {0,0,0,0,0},c[5] = {0,0,0,0,0};
scanf("%s",f);
//printf("\n");
scanf("%s",b);
//printf("\n");
for(j=0;j<3;j++){
if(f[j] == 'b' || b[j] == 'b'){
countb++;
a[k] = j;
k++;
}
if(f[j] == 'o' || b[j] == 'o'){
counto++;
c[t] = j;
t++;
}
}
if(countb ==2 && counto >=1){
if((a[0] == 0 && a[1] == 1) || (a[0] == 1 && a[1] == 1)){
if((c[0] == 2) || (c[1] == 2) || (c[2] == 2)){
bhoo++;
}
}
else if((a[0] == 0 && a[1] == 2) || (a[0] == 2 && a[1] == 0)){
if((c[0] == 1) || (c[1] == 1) || (c[2] == 1)){
bhoo++;
}
}
else if((a[0] == 2 && a[1] == 1) || (a[0] == 1 && a[1] == 2)){
if((c[0] == 0) || (c[1] == 0) || (c[2] == 0)){
bhoo++;
}
}
else{
}
}
else if(countb == 3 && counto >=1){
bhoo++;
}
else{
}
check[g] = bhoo;
g++;
}
}
for(i=0;i<g;i++){
if(check[i] != 0){
printf("yes\n");
}
else{
printf("no\n");
}
}
}
THIS IS MY CODE.