Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define endl '\n'
- #define sz(x) int(x.size())
- #define all(x) x.begin(), x.end()
- int main() {
- ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- int test;
- cin >> test;
- cin.ignore();
- while (test--) {
- string s;
- getline(cin, s);
- int f = 0, m = 0;
- for (int i = 0; i < sz(s); i++) f += (s[i] == 'F'), m += (s[i] == 'M');
- cout << (f > 1 && m > 1 && m == f ? "LOOP" : "NO LOOP") << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement