#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;

const double EPS = 1e-9;
const double PI = 3.14159265359;

typedef complex<double> P;

int main(){
	string s;
	stringstream ss;

	while(getline(cin, s)){
		vector<string> v;
		for(int i = 0; i < s.size(); i++){
			if(s[i] == ',' || s[i] == '.'){
				s[i] = ' ';
			}
		}
		ss << s;
		while(ss >> s){
			if(s.size() >= 3 && s.size() <= 6){
				v.push_back(s);
			}
		}
		bool f = true;
		for(int i = 0; i < v.size(); i++){
			if(!f){
				cout << ' ';
			}
			f = false;
			cout << v[i];
		}
		cout << endl;
	}

	return 0;
}