while True:
    try:
        a=input()
        for i in range(len(a)):
            if not a[i].isalpha():
                a=a.replace(a[i],' ')
                
        #print(a)
        b= a.split(' ')
        b.reverse()
        print(' '.join(b))
    except:
        break