atcoder#ABC157E. [ABC157E] Simple String Queries
[ABC157E] Simple String Queries
Score : points
Problem Statement
You are given a string of length consisting of lowercase English letters.
Process queries of the following two types:
- Type : change the -th character of to . (Do nothing if the -th character is already .)
- Type : answer the number of different characters occurring in the substring of between the -th and -th characters (inclusive).
Constraints
- , , , , and are integers.
- is a string consisting of lowercase English letters.
- is a lowercase English letter.
- There is at least one query of type in each testcase.
Input
Input is given from Standard Input in the following format:
Here, in the -th through -th lines is one of the following:
Output
For each query of type , print a line containing the answer.
7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7
3
1
5
In the first query, cdbb
contains three kinds of letters: b
, c
, and d
, so we print .
In the second query, is modified to abcdzbd
.
In the third query, a
contains one kind of letter: a
, so we print .
In the fourth query, is modified to abcazbd
.
In the fifth query, does not change and is still abcazbd
.
In the sixth query, abcazbd
contains five kinds of letters: a
, b
, c
, d
, and z
, so we print .