#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <string>
#include <cmath>
#include <algorithm>
#define CHAR_NUM 1025
using namespace std;

int isexcept(int ch);
void reverse(char str[]);

int main(void) {
    string str;
    char ans[CHAR_NUM] = {'\0'};
    int i, j, len;
    int count = 0;
    
    getline(cin, str);
    
    for(i = 0; str[i]; i++) {
        char temp[10] = {'\0'};
        int idx = 0;
        if(isexcept(str[i])) {
            count++;
        } else if(count > 2 && count < 7) {
            count = 0;
            for(j = i - 1; (isexcept(str[j]) && !(j < 0)); j--) {
                temp[idx++] = str[j];
            }
            reverse(temp);
            strcat(ans, temp);
            len = (int)strlen(ans);
            ans[len] = ' ';
        } else {
            count = 0;
        }
    }
    len = (int)strlen(ans);
    ans[len - 1] = '\0';
    
    cout << ans << endl;
    
    return(0);
}
 
int isexcept(int ch) {
    return((ch != ',' && ch != ' ') && ch != '.');
}

void reverse(char str[]) {
    char temp[2] = {'\0'};
    int i;
    int len = (int)strlen(str);
    
    for(i = 0; i < len / 2; i++) {
        temp[0] = str[len - 1 - i];
        str[len - 1 - i] = str[i];
        str[i] = temp[0];
    }
}