python求助前三个wa,测试结果是对的

P5734 【深基6.例6】文字处理软件

serieniii @ 2024-10-29 09:39:33

n=int(input())
y=input()
for i in range(n):
    s=input()
    if s[0]=="1":
        y=y+s[2:]
        print(y)
    elif s[0]=="2":
        m=int(s[2])
        mm=int(s[4])
        if m+mm>len(y):
            y=y[m:]
        else:
            y=y[m:m+mm]
        print(y)
    elif s[0]=="3":
        x=int(s[2])
        y=y[:x]+s[4:]+y[x:]
        print(y)
    elif s[0]=="4":
        x=s[2:]
        print(y.find(x))

|