#P8796. [蓝桥杯 2022 国 AC] 替换字符
[蓝桥杯 2022 国 AC] 替换字符
Problem Description
Given a string that contains only lowercase English letters, each operation chooses an interval and replaces all letters in this interval of with the letter . After all operations are completed, output the resulting string.
Input Format
The first line contains a string .
The second line contains an integer .
The next lines each contain parameters , separated by a single space. Here are integers, and are lowercase letters.
Output Format
Output one line containing a string representing the answer.
abcaaea
4
1 7 c e
3 3 e b
3 6 b e
1 4 a c
cbecaea
Hint
【Scale and Constraints of testdata】
- For of the testdata, .
- For all testdata, , , , where denotes the length of the string .
Lanqiao Cup 2022 National Contest Group A Problem H (Group C Problem J).
Translated by ChatGPT 5