r=io.read f=r()<'e's=r'*a'for i=1,4021,2 do c=s:sub(i,i)j=4023-i io.write(f and s:sub(1,1)or c>''and c or s:sub(j,j))s=f and s:sub(2):reverse()or s end