Advertisement
SAMonna

I - Train Tracks

Jan 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6. int main(){
  7. int t, length, i, female, male, n, j, k, result;
  8. string str;
  9.  
  10. cin >> t;
  11.  
  12. while(t--){
  13. getline(cin, str);
  14. length = str.size();
  15. result = 0;
  16.  
  17. for(i = 1; i <= length - 1; i+=3){
  18. if(str[i] != str[i + 2]){
  19. result = 1;
  20. } else {
  21. result = 0;
  22. break;
  23. }
  24. }
  25.  
  26. if(result == 1){
  27. cout << "LOOP" << endl;
  28. } else {
  29. cout << "NO LOOP" << endl;
  30. }
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement