#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

string ws,wk;
	while(getline(cin,ws)){
//		getline(cin,ws);
		if(cin.eof()) break;
		replace(ws.begin(),ws.end(),',',' ');
		replace(ws.begin(),ws.end(),'.',' ');
		stringstream zz;
		zz << ws;
		int ct=0;
		while(zz >> wk){
			if(wk.size()>=3 && wk.size()<=6){
				if(ct != 0 ) cout << " ";
				cout << wk ;
				ct++;
			}
		}
		cout << endl;

	}
	return 0;
	
}