卡了一下输入,其他就是常规写法 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))