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