Plabon_dutta

Uva 11586

Mar 6th, 2021 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     scanf("%d%*c", &n);
  8.     while(n--) {
  9.         int f=0, m=0;
  10.         char ch;
  11.         while(1) {
  12.             scanf("%c", &ch);
  13.             if(ch=='\n') break;
  14.             else if(ch=='M') m++;
  15.             else if(ch=='F') f++;
  16.         }
  17.         if(f==m && m==1) printf("NO LOOP\n");
  18.         else if(f==m) printf("LOOP\n");
  19.         else printf("NO LOOP\n");
  20.     }
  21.     return 0;
  22. }
  23.  
Add Comment
Please, Sign In to add comment