#T1002. String基本练习:插入
String基本练习:插入
题目描述
STL string 基本练习题。
按照要求在字符串 中进行操作。
输入
第一行,一个字符串 。 第二行,一个整数 ,表示将有 次操作,。 接下来 行,每行若干个数据,具体数据描述如下:
- 当 action = 1 的时候,该行包括三个数据
pos c n,其中pos表示插入位置,c表示插入字符,n表示插入字符数量。例如1 5 b 4,表示在第 5 个位置插入 4 个字符b; - 当 action = 2 的时候,其后跟随一行,
pos s2,其中pos表示插入位置,s2表示插入字符串。例如2 5 abc,表示在第 5 个位置插入字符串abc; - 当 action = 3 的时候,其后跟随一行,
pos n s2,其中pos表示插入位置,n表示插入字符数量,保证 小于 的长度。例如3 5 3 hello, 表示在字符串的第 5 个位置插入hello的前 3 个字符。
输入的字符串都可能不包含空格(注意:样例中 本身含空格,读入需按整行处理)。
输出
行,每行一个字符串,表示经过操作后,得到的结果字符串。
Please split this sentence into tokens
3
1 5 b 4
2 5 abc
3 5 3 hello
Pleasbbbbe split this sentence into tokens
Pleasabcbbbbe split this sentence into tokens
Pleashelabcbbbbe split this sentence into tokens
说明/提示
;插入位置 pos 为 0 起下标、插在该位置之前。