# import sys
while True:
    try:
        s = input()
        words = []
        word = ''
        for c in s:
            if c.isalpha():
                word += c 
            else:
                if word != '':
                    words.append(word)
                    word = ''
        if word != '':
            words.append(word)
            word = ''
        print(' '.join(words[::-1]))
    except:
#         print(sys.exc_info())
        break