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

void main(){
    stdin.readln.chomp.filter!(a => a != ',' && a != '.').array.split.filter!(a => a.length > 2 && a.length < 7).reduce!((a, b) => a ~ " " ~ b).writeln;
}