def Main(): s=input() n=len(s) t="" a="" for i in range(n): if "a"<=s[i]<="z": t+=s[i] else: a=s[i:] break print(t[::-1]+a) Main()