while True:
    try:
        sentence = input()
        for i in range(len(sentence)):
            if sentence[i].isalpha() == False:
                sentence = sentence.replace(sentence[i], ' ')
        sentence = sentence.split()
        print(' '.join(sentence[::-1]))
    except:
        break