#P6373. 「StOI-1」IOI 计数
「StOI-1」IOI 计数
Description
Given a string of length , perform operations:
Operation 1: means changing the -th character to (where is only I or O).
Operation 2: asks how many triples in the string satisfy:
I, O, I, and .
Input Format
The first line contains two positive integers and .
The next line contains a string of length , and the next lines contain the operations.
Their meanings are the same as described above.
Output Format
Output multiple lines: for every operation 2, output the answer to the query, with each answer on its own line.
4 3
IOOI
2 1 4
1 1 O
2 1 2
2
0
10 10
IIOOIOIIIO
1 1 I
2 1 7
1 5 O
2 5 9
1 4 I
1 10 I
2 1 10
2 5 10
2 2 8
2 3 9
11
0
34
0
11
6
Hint
Constraints:
For % of the testdata: , .
For another % of the testdata: , , .
For another % of the testdata: , .
For % of the testdata: , .
All input is guaranteed to be valid.
Translated by ChatGPT 5
京公网安备 11011102002149号