题解 | 字符串操作

字符串操作

https://www.nowcoder.com/practice/06a5336b64e3481fbbcc1f7d5cba548d

n, m = map(int, input().split())
s = input()  

for _ in range(m):
    a, b, c, d = input().split()
    a, b = int(a), int(b)  

    s_list = list(s)

    for i in range(a-1, b):
        if s_list[i] == c:
            s_list[i] = d

    s = "".join(s_list)

print(s)

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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