Home => ProblemSet => 3.2-16:Subpalindromes
Problem1832--3.2-16:Subpalindromes

1832: 3.2-16:Subpalindromes

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 2
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

You have a string and queries of two types:
  1. replace i’th character of the string by character a;
  2. 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 Copy

abcda
5
palindrome? 1 5
palindrome? 1 1
change 4 b
palindrome? 1 5
palindrome? 2 4

Sample Output Copy

No
Yes
Yes
Yes