Simple string manipulation (string)

Description


Give you a string \(S\) with a length of \(n\) and only lowercase letters (subscripts start from \(1\) to \(n\)), perform the following two operations \(Q\) times:
1 i c: Replace the character at position \(i\) in the string \(S\) with the character \(c\);
2 l r: The number of different characters from the \(l\)th position to the \(r\)th position in the query string \(S\).

Format


Input

The first line contains an integer \(n\), which represents the length of the string \(S\).
The second line contains a string \(S\) of length \(n\), containing only lowercase letters.
The third line contains an integer \(Q\), which represents the number of operations.
In line \(4 \sim Q+3\), each line describes one of the above two operations.

Output

For each operation \(2\), the output line contains an integer, which represents the number of different characters in \(S[l \dots r]\).

Sample


Input

7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7

Output

3
1
5

Hint


\(\text{Subtask1(50%)}\)\(1\le n \le 100\)
\(\text{Subtask2(50%)}\)\(1\le n \le 500000, 1 \le Q \le 20000\)

Sample Code


Code is not available!
posted @ 2020-10-14 21:08  Sample_Test  阅读(118)  评论(0编辑  收藏  举报