题解 | #字符串操作#

字符串操作

http://www.nowcoder.com/questionTerminal/06a5336b64e3481fbbcc1f7d5cba548d

卡了一下输入,其他就是常规写法
n,m = map(int, input().split())
s = input()
ss = []
for i in s:
    ss.append(i)
    
for i in range(m):
    l,r,ch1,ch2 = input().split()
    #l,r = map(int, input().split())
    #ch1,ch2 = map(str,input().split())
    for j in range(int(l)-1,int(r)):
        if ss[j] == ch1:
            ss[j] = ch2
print(''.join(ss))




全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务