while True: try: str1=input() list1=list() stack=list() for i in str1: if i.isalpha(): stack.append(i) else: if len(stack)!=0: list1.append("".join(stack)) stack=[] if len(stack)!=0: list1.append("".join(stack)) stack=[] list2=list1[::-1] print(" ".join(list2)) except: break