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 ≤ 10 5). 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 substrings j... s k is a palindrome and “No” otherwise.
Example
input
Subpalindromes 哈希+树状数组
最新推荐文章于 2021-09-08 16:57:59 发布