import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;

void main(){
    auto s = split(readln());
    string[] s1;
    foreach(i;s) s1 ~= i.split('.');
    string[] s2;
    foreach(i;s1) s2 ~= i.split(',');
    for(int i=0;i<s2.length-1;i++) {
	int len = to!int(s2[i].length);
	if(3<=len&&len<=6){
	    writef("%s ",s2[i].chomp());
	}
    }
    int len = to!int(s2[s2.length-1].length);
    if(3<=len&&len<=6){
	writef("%s\n",s2[s2.length-1].chomp());
    }
}