Problem 2738 --String - Transformation

2738: String - Transformation

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $115$ 正确数量 $59$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL 字符串

Transformation 

Write a program which performs a sequence of commands to a given string str. The command is one of: 

print a b: print from the a-th character to the b-th character of str 

reverse a b: reverse from the a-th character to the b-th character of str 

replace a b p: replace from the a-th character to the b-th character of str with p 


Note that the indices of str start with 0.

In the first line, a string str is given. str consists of lowercase letters. In the second line, the number of commands q is given. In the next q lines, each command is given in the above mentioned format.
For each print command, print a string in a line.
abcde
3
replace 1 3 xyz
reverse 0 2
print 1 4
xaze

1≤ length of str≤1000

1≤q≤100 

0≤a≤b< length of str 

for replace command, b−a+1= length of p

推荐代码 查看2738 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 每天一图灵 807062 2022-01-05 23:30:12
内存最少[$0 $KB] Shmily丶双 555675 2019-12-16 20:22:05
第一AC 刘成健 320260 2018-11-20 12:39:46
第一挑战 卑微小赵 299882 2018-10-30 10:19:24

赛题来源/所属竞赛 会津大学《C++ Programming I》 C++程序设计(入门)

竞赛编号 竞赛名称 竞赛时间 访问比赛
1676 2021-2022-1学期《程序设计技能实训》字符串和指针【21计算机1234班】 2021-12-14 07:00:00 请登录
1489 2019年安徽科技学院《ACM程序设计》第50周赛 2019-12-15 16:00:00 请登录
1488 2019-2020-1学期《C语言程序设计技能实训》第三场:字符串和指针【19计算机12班】 2019-12-04 22:00:00 请登录