#include <stdio.h>

//1、P2记录单词的末尾位置
//2、P1记录单词的开头位置

int isLetter(char c)
{
    if(c >= 'A' && c <= 'Z'
          || c >= 'a' && c <= 'z')

    {
        return 1;
    }
    else
    {
        return 0;
    }
}

int main()
{
    char str[10000] = {0};
    gets(str);
    int len = strlen(str);
    int p1 = len-1;
    int p2 = len;
    while(p1 >= 0)
    {
        while(p1 >= 0 && !isLetter(str[p1]))//判断字符串的结尾
        {
            p1--;
        }
        p2 = p1;
        while(p1 >= 0 && isLetter(str[p1]))//判断字符串的开头
        {
            p1--;
        }
        for(int i = p1+1; i <= p2; i++)//输出该字符串
        {
            printf("%c", str[i]);
        }
        printf(" ");
    }
    return 0;
}