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