dhdchsv @ 2024-11-05 20:48:31
n=int(input())
s=input()
for i in range(n):
a=list(input().split())
if a[0]=="1":
s+=a[1]
print(s)
elif a[0]=="2":
s=s[int(a[1]):int(a[1])+int(a[2])]
print(s)
elif a[0]=="3":
s=s[:int(a[1])]+a[2]+s[int(a[1]):]
print(s)
elif a[0]=="4":
print(int(s.find(a[1])))