S=input() A=input() A=list(A) S=list(S) i=int(A[0]) j=int(A[2]) S[i],S[j]=S[j],S[i] l = len(S) for i in range(l-1): print(S[i], end='') print(S[-1])