Advertisement
MiinaMagdy

11586 - Train Tracks

Sep 3rd, 2022
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define endl '\n'
  7. #define sz(x) int(x.size())
  8. #define all(x) x.begin(), x.end()
  9.  
  10. int main() {
  11.     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  12.    
  13.     int test;
  14.     cin >> test;
  15.     cin.ignore();
  16.     while (test--) {
  17.         string s;
  18.         getline(cin, s);
  19.         int f = 0, m = 0;
  20.         for (int i = 0; i < sz(s); i++) f += (s[i] == 'F'), m += (s[i] == 'M');
  21.         cout << (f > 1 && m > 1 && m == f ? "LOOP" : "NO LOOP") << endl;
  22.     }
  23. }
  24.  
Tags: UVA CP3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement