#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>

using namespace std;

int main(){
	string s;
	while(getline(cin,s)){
		replace(s.begin(),s.end(),',',' ');
		replace(s.begin(),s.end(),'.',' ');
		istringstream iss(s);
		set<string> st;
		string b;
		int i = 0;
		while(iss>>b) if(b.size() >= 3 && b.size() <= 6){
			if(i != 0)
				cout << " ";
			cout << b;
			i++;
		}
		puts("");
	}
    return 0;
}