def change(s):
for i in range(len(s)//2):
s[i*2], s[(i*2)+1] = s[(i*2)+1], s[i*2]
return s
def twosort(s):
name = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(s)//2):
if name.index(s[i*2]) > name.index(s[(i*2)+1]):
s[i*2], s[(i*2)+1] = s[(i*2)+1], s[i*2]
return s
def wash(s):
a = s[0:(len(s)//2)]
b = s[(len(s)//2):len(s)]
c=[]
for i in range(len(s)//2):
c.append(a[i])
c.append(b[i])
return c
s = list(input())
k = int(input())
for i in range(k):
a = int(input())
if a == 0:
s = change(s)
elif a == 1:
s = twosort(s)
elif a == 2:
s = wash(s)
for j in s:
print(j, end="")