luogu#P2787. 语文1(chin1)- 理理思维
语文1(chin1)- 理理思维
Background
Rookie HansBug scratched his head countless times in the Chinese exam, but his mind was still completely blank.
Problem Description
The exam has started, but HansBug's mind is still blank. Oh no! To be precise, it is a total mess. Your primary task now is to help HansBug organize his thoughts. Assume HansBug's thoughts form a long string (containing only the letters). Now you have a magic prescription that contains three operations in order:
- Get how many times letter appears from the -th to the -th character.
- Set all characters from the -th to the -th to letter .
- Sort the characters from the -th to the -th in order.
Just when you are overjoyed, his brain cells and RP have already been exhausted by previous nervousness, and there is still an -word essay at the end of the paper. So this crucial task is up to you!
Input Format
The first line contains two integers , denoting the number of letters in HansBug's thoughts and the number of operations on the prescription, respectively. The second line contains a string of length , representing HansBug's thoughts.
Then follow lines, each describing an operation in the following format (positions are -based and inclusive):
1 x y kmeans to output how many times appears from the -th to the -th character.2 x y kmeans to replace all characters from the -th to the -th with .3 x ymeans to sort the characters from the -th to the -th in order.
Output Format
Output several lines, each containing an integer, which are the results of all type 1 operations in order.
10 5
ABCDABCDCD
1 1 3 A
3 1 5
1 1 3 A
2 1 2 B
1 2 3 B
1
2
2
Hint
Sample explanation:

Constraints:

This problem is case-insensitive.
Three additional hack testdata groups have been added, which are not in the table above, but it is guaranteed that .
Translated by ChatGPT 5