#P128. [KSC004B] Luogu

[KSC004B] Luogu

Source

This problem is adapted from Long Long OJ. All rights reserved.

Problem Description

Given a string (indexed from 11) and qq queries, each query asks for the count of characters l,u,o,g,uu\tt{l,u,o,g,uu} in the interval [x,y][x,y] of the string.

Input Format

  • The first line contains a string ss.
  • The second line contains an integer qq.
  • The next qq lines: Each line contains two space-separated integers xx and yy.

Output Format

Output qq lines, each containing 55 numbers representing the counts of l,u,o,g,uu\tt{l,u,o,g,uu} 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 10%10\% of the data, 1q,s201\le q,|s|\le20.
  • For 90%90\% of the data, q=s=106q=|s|=10^6.
  • The string contains only the letters l,u,o,g,u\tt{l,u,o,g,u}.
  • It is guaranteed that 1xys1 \le x \le y \le |s|.