You have a string and queries of two types:
- replace i’th character of the string by character a;
- check if substring sj...sk is a palindrome.
Input
The first line contains a string consisting of n small English letters.
The second line contains an integer m that is the number of queries
(5 ≤ n, m ≤ 105). The next m lines contain the queries.
Each query has either form “change i a”, or “palindrome? j
k”, where i, j, k are integers (1 ≤ i ≤ n; 1 ≤ j ≤ k ≤ n), and
character a is a small English letter.
Output
To all second type queries, you should output “Yes” on a single
line if substring sj...sk is a palindrome and “No” otherwise.
Sample
input | output |
---|
abcda
5
palindrome? 1 5
palindrome? 1 1
change 4 b
palindrome? 1 5
palindrome? 2 4
| No
Yes
Yes
Yes
|
Problem Author: Mikhail Rubinchik
Problem Source: Open Ural FU Championship 2013