#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

// ティツ、ツ?ヲツ閉ーテヲツ鳴?・ツュツ耀plit
vector<string> split(const string &str, const string &delim = " ") {
    size_t start = 0, pos;
    vector<string> result;
    
    while ( (pos = str.find_first_of( delim, start) ) != string::npos ) {
        if (pos - start != 0)
            result.push_back( str.substr( start, pos - start) );
        start = pos + 1;
    }
    if (str.size() - start != 0)
        result.push_back( str.substr( start, str.size() - start ) );

    return result;
}

int main(void) {
	string s;
	getline(cin, s);

	vector<string> sp = split(s, ",. ");

	vector<string> ans;
	for (auto &str : sp) {
		int sz = str.size();
		if (3 <= sz && sz <= 6) {
			ans.push_back(str);
		}
	}

	for (int i = 0; i < (int)ans.size(); i++) {
		cout << ans[i] << (i + 1 == (int)ans.size() ? '\n' : ' ');
	}

	return 0;
}