Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string s;
- getline(cin, s);
- int i, j;
- cin >> i >> j;
- i--, j--;//индексация с "0", а считать начинаем с "1"
- bool fl = true;
- while (j - i >= 0)
- {
- if (s[i] != s[j])
- {
- fl = false;
- break;
- }
- i++, j--;
- }
- if (fl)
- cout << "YES\n";
- else
- cout << "NO\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement