Advertisement
AquaBlitz11

[t101] Check Palindrome (Easy)

Oct 9th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     char A[100010];
  7.     scanf("%s", A);
  8.     int n = strlen(A);
  9.     int ok = 1;
  10.     for (int i = 0; i < n; ++i) {
  11.         if (A[i] != A[n-i-1]) {
  12.             ok = 0;
  13.             break;
  14.         }
  15.     }
  16.     printf("%s\n", ok ? "YES" : "NO");
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement