#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	vector<string> v;
	string s;
	getline(cin, s);
	while(s.size() != 0){
		int n = 0;
		while(n < s.size() && s[n] != ' ') n++;
		string t = s.substr(0, n);
		bool b = false;
		if(t[t.size()-1] == ',' || t[t.size()-1] == '.') t = t.substr(0, t.size()-1);
		v.push_back(t);
		if(n == s.size()) break;
		s = s.substr(n+1);
	}
	bool b = false;
	for(int i=0; i < v.size(); i++) if(3 <= v[i].size() && v[i].size() <= 6){ cout << (b ? " " : "") << v[i]; b = true;}
	cout << endl;
}