queries from liwi to answer. The queries are as follows:
has been givenYou are given a string, , with size , consisting of characters
#
and.
You are also given , the number of queries.For each query, you are given two integers, and .
The solution to each query is the number of such integers , that .
Input Specification
The first line contains a string of length . It is guaranteed that the string will only contain the characters #
and .
The second line of input will contain , the number of queries you are to process.
The next lines will contain 2 integers, and .
Output Specification
Print integers, the answers to the queries in the order given in the input, each on a separate line.
Sample Input 1
......
4
3 4
2 3
1 6
2 6
Sample Output 1
1
1
5
4
Sample Input 2
#..###
5
1 3
5 6
1 5
3 6
3 4
Sample Output 2
1
1
2
2
0
Comments