#python3求助! 不知道错在哪里

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

wushuang123 @ 2024-09-14 12:14:36

q = int(input())

s = input()

for i in range(q):

s1 = input().split()
f = s1[0]
if(int(f) == 1):
    s = s + s1[1]
    print(s)
if(int(f) == 2):
    a = int(s1[1])
    b = int(s1[2])
    s = s[a:a+b]
    print(s)
if(int(f) == 3):
    list_s = list(s)
    list_s.insert(int(s1[1]), s1[2])
    s = ''.join(list_s)
    print(s)        
if(int(f) == 4):
    print(s.find(s1[1]))

|