what is wrong with my code for SPOON

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int T,R,C;
char str[101][101];
scanf("%d",&T);

while(T--)
{ int i,j,flag=0;
    scanf("%d %d",&R,&C);

  for(i=0;i<R;i++)
  { j=0;
      scanf("%s",&str[i]);

       while(str[i][j]!='\0')
        {
            if(isupper(str[i][j]))
               str[i][j]=tolower(str[i][j]);
            j++;
        }
  }

  for(i=0;i<R;i++)
  {
      for(j=0;j<C;j++)

      if((str[i][j]=='s')&&j+4<C)
      {
           if((str[i][j+1]=='p')&&(str[i][j+2]=='o')&&(str[i][j+3]=='o')&&(str[i][j+4]=='n'))
        {
          flag=1;
          break;
        }
      }
      if((str[i][j]=='s')&&i+4<R)
      {
          if((str[i+1][j]=='p')&&(str[i+2][j]=='o')&&(str[i+3][j]=='o')&&(str[i+4][j]=='n'))
          {
              flag=1;
              break;
          }
      }

  }
  if(flag==1)
  {
       printf("There is a spoon!\n");
  }
  else
  {
     printf("There is indeed no spoon!\n");
  }
}
return 0;

}

Your code gives wrong result for the provided test cases. You have mismatched braces in the inner for loop. Otherwise the solution is correct.

You can check the same solution AC here with the corrected braces.