#P128. [KSC004B] Luogu
[KSC004B] Luogu
Source
This problem is adapted from Long Long OJ. All rights reserved.
Problem Description
Given a string (indexed from ) and queries, each query asks for the count of characters in the interval of the string.
Input Format
- The first line contains a string .
- The second line contains an integer .
- The next lines: Each line contains two space-separated integers and .
Output Format
Output lines, each containing numbers representing the counts of respectively.
Samples
llouugulouugol
5
1 9
1 9
8 10
1 14
5 14
3 3 2 1 1
3 3 2 1 1
1 1 1 0 0
4 5 3 2 2
2 4 2 2 1
Data Range
- For of the data, .
- For of the data, .
- The string contains only the letters .
- It is guaranteed that .