#T1003. String基本练习:替换
String基本练习:替换
题目描述
STL string 基本练习题。
按照要求将字符串 中指定位置内容替换成指定内容。
输入
第一行,一个字符串 。
第二行,一个整数 ,表示将有 次操作,。
接下来 行,每行包含三个数据 pos len s2,其中 pos 表示要替换的位置,
len 表示替换的长度,s2 表示替换后的内容。
输出
行,每行一个字符串,表示经过替换操作后,得到的结果字符串。
Please split this sentence into tokens
3
0 6 You
0 3 I
9 1 Help
You split this sentence into tokens
I split this sentence into tokens
I split tHelpis sentence into tokens
说明/提示
;替换区间为 0 起下标、左闭右开 ——
样例第三步 9 1 Help 把 this 的 h(下标 9)换成 Help 得 tHelpis,
即 s1.replace(pos, len, s2) 的语义。数据保证 且