Advertisement
Infiniti_Inter

bogdan Jivi

Dec 13th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8.     string s;
  9.     getline(cin, s);
  10.     int i, j;
  11.     cin >> i >> j;
  12.     i--, j--;//индексация с "0", а считать начинаем с "1"
  13.     bool fl = true;
  14.     while (j - i >= 0)
  15.     {
  16.         if (s[i] != s[j])
  17.         {
  18.             fl = false;
  19.             break;
  20.         }
  21.         i++, j--;
  22.     }
  23.     if (fl)
  24.         cout << "YES\n";
  25.     else
  26.         cout << "NO\n";
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement