Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdlib.h>
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int t, length, i, result;
- string str;
- scanf("%d ", &t);
- while(t--){
- getline(cin, str);
- length = str.size();
- result = 0;
- if(length >= 5){
- for(i = 1; i <= length - 2; i+=3){
- if(str[i] != str[i + 2]){
- result = 1;
- } else {
- result = 0;
- break;
- }
- }
- }
- if(result == 1){
- cout << "LOOP" << endl;
- } else {
- cout << "NO LOOP" << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement