题目描述
Problem Description
You are developing a robot that processes strings. When given a string $ t $ consisting only of lowercase English letters, the robot processes the string according to the following steps:
- Choose the smallest $ i $ such that $t_i\ =\ t_{i\ +\ 1}$. If no such $ i $ exists, the process ends.
- If $ t_i $ is
z, remove $ t_i $ and $t_{i\ +\ 1}$. If $ t_i $ is notz, let $ c $ be the next alphabet after $ t_i $, and replace $ t_i $ and $t_{i\ +\ 1}$ with the single character $ c $. - Return to step 1.
For example, if the string axxxxza is given to the robot, the string is processed as axxxxza → ayxxza → ayyza → azza → aa → b.
You are given a string $ s $ consisting only of lowercase English letters. Answer $ Q $ queries about $ s $. The $ i $th query is as follows:
- If the substring of $ s $ from the $ l_i $th to the $ r_i $th character (inclusive) is given to the robot, will the processed string become an empty string?
Input Format
The input is given from the standard input in the following format:
$ s $ $ Q $ $ l_1 $ $ r_1 $ $ l_2 $ $ r_2 $ $ : $ $ l_Q $ $ r_Q $
Output Format
Output $ Q $ lines. The $ i $th line should contain Yes or No as the answer to the $ i $th query.
Sample Input and Output
Sample Input #1
axxxxza
2
1 7
2 6
Sample Output #1
No
Yes
Sample Input #2
aabcdefghijklmnopqrstuvwxyz
1
1 27
Sample Output #2
Yes
Sample Input #3
yzyyyzyzyyyz
8
1 6
7 12
1 12
6 11
1 1
1 3
4 9
3 8
Sample Output #3
Yes
Yes
Yes
Yes
No
No
No
No
Notes/Hints
Constraints
- $1\ \leq\ |s|\ \leq\ 5\ \times\ 10^5$
- $ s $ consists only of lowercase English letters.
- $1\ \leq\ Q\ \leq\ 10^5$
- $1\ \leq\ l_i\ \leq\ r_i\ \leq\ |s|$
Sample Explanation 1
- For the first query, the string is processed as
axxxxza→ayxxza→ayyza→azza→aa→b. - For the second query, the string is processed as
xxxxz→yxxz→yyz→zz→ ``.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分