Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- int n;
- scanf("%d%*c", &n);
- while(n--) {
- int f=0, m=0;
- char ch;
- while(1) {
- scanf("%c", &ch);
- if(ch=='\n') break;
- else if(ch=='M') m++;
- else if(ch=='F') f++;
- }
- if(f==m && m==1) printf("NO LOOP\n");
- else if(f==m) printf("LOOP\n");
- else printf("NO LOOP\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment