求助Python3个WA
查看原帖
求助Python3个WA
569942
peaple_with_a_dream楼主2022/1/2 21:56
n=int(input())
s=input()
for i in range(n):
    m=input().split()
    opt=int(m[0])
    if opt==1:
        s=s+m[1]
        print(s)
    elif opt==2:
        q=int(m[1])
        l=int(m[2])
        s=s[q:q+l]
        print(s)
    elif opt==3:
        q=int(m[1])
        a=m[2]
        t=list(s)
        s=''
        t.insert(q,a)
        for j in t:
            s+=j
        print(s)
    else:
        a=m[1]
        try:
            print(s.index(a))
        except:
            print(-1)

本地测全对,实测前三个点WA

2022/1/2 21:56
加载中...