8625

#include<stdio.h>
main()
{
      int b,a,t;
      char s[50],ch;
      scanf("%d\n",&t);
      while(t--)
      {
          b=a=0;
          scanf("%c",&ch);
          while(ch!='\n')
          {
              if(ch=='F') a++;
              if(ch=='M') b++;
              scanf("%c",&ch);
          }
          if(b==a) printf("LOOP\n");
          else printf("NO LOOP\n");
      }
}

 

posted @ 2015-10-30 22:29  scau_zk  阅读(164)  评论(0编辑  收藏  举报