#P5734. 【深基6.例6】文字处理软件
【深基6.例6】文字处理软件
Description
You need to develop a word processing software. At the beginning, input a string as the initial document. You may assume that the start of the document is the -th character. The following operations must be supported:
1 str: Append insertion. Insert the string at the end of the document, and output the document string.2 a b: Extract part of the document. Keep only characters starting from the -th character of the document, and output the document string.3 a str: Insert a segment. Insert the string before the -th character in the document, and output the document string.4 str: Find a substring. Output the earliest position of the string in the document; if it cannot be found, output .
To simplify the problem, the initial document and in each operation contain no spaces or newlines. There will be at most operations.
Input Format
The first line contains a positive integer , representing the number of operations.
The second line contains a string , representing the initial string.
Starting from the third line, the next lines each describe an operation, as shown in the problem description.
Output Format
Output a total of lines.
For each operation , output a string as required.
For operation , output an integer as required.
4
ILove
1 Luogu
2 5 5
3 3 guGugu
4 gu
ILoveLuogu
Luogu
LuoguGugugu
3
Hint
Constraints: , and the length of the initial string is .
Translated by ChatGPT 5
京公网安备 11011102002149号