Advertisement
silentkiler029

19#10-A

Apr 28th, 2020
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. ///BISMILLAHIR-RAHMANIR-RAHIM
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     int t;
  8.     scanf("%d", &t);
  9.  
  10.     char s[1000005], l[1000005], r[1000005];
  11.     int len, i, decision;
  12.  
  13.     while(t--){
  14.         scanf("%s", s);
  15.         len = strlen(s);
  16.  
  17.         for(i = 0; i < len - 1; i++){
  18.             l[i] = s[i + 1];
  19.         }
  20.         l[len - 1] = s[0];
  21.         l[len] = '\0';
  22.  
  23.         for(i = 1; i < len; i++){
  24.             r[i] = s[i - 1];
  25.         }
  26.         r[0] = s[len - 1];
  27.         r[len] = '\0';
  28.  
  29.         decision = strcmp(l, r);
  30.         if(decision == 0) printf("YES\n");
  31.         else printf("NO\n");
  32.  
  33.     }
  34.  
  35.  
  36.     return 0;
  37. }
  38. ///ALHAMDULILLAH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement