#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    bool first = true;
    string s;
    getline(cin, s);
    int i = 0;

    for(;;){
        int j = s.find_first_of("., ", i);
        if(j == string::npos)
            return 0;

        string s1 = s.substr(i, j-i);
        if(3 <= s1.size() && s1.size() <= 6){
            if(first)
                first = false;
            else
                cout << ' ';
            cout << s1;
        }
        i = j+1;
    }
}