-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUva11568.cpp
More file actions
44 lines (38 loc) · 740 Bytes
/
Copy pathUva11568.cpp
File metadata and controls
44 lines (38 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <sstream>
using namespace std;
int main()
{
int TC;
cin>>TC;
cin.ignore();
string line;
while(TC--){
getline(cin,line);
int count=0;
for(string::iterator iter=line.begin();iter!=line.end();iter++){
if(*iter=='M'){
count++;
}
if(*iter=='F'){
count--;
}
}
if(count==0 && line.size()>3){
cout<<"LOOP"<<endl;
}
else{
cout<<"NO LOOP"<<endl;
}
}
return 0;
}