Advertisement
Josif_tepe

Untitled

Feb 14th, 2022
895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     string s;
  5.     cin >> s;
  6.     int i = 0;
  7.     int j = s.size() - 1;
  8.    
  9.     while(i < j) {
  10.         if(s[i] == s[j]) {
  11.             i++;
  12.             j--;
  13.         }
  14.         else {
  15.             cout << "NE E PALINDROM" << endl;
  16.             return 0;
  17.         }
  18.     }
  19.     cout << "PALINDROM" << endl;
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement