#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    string s;
    vector<string> v;
    while(cin >> s) {
        if (s.back() == '.' || s.back() == ',') {
            s.pop_back();
        }
        if (s.size() > 2 && s.size() < 7) {
            v.push_back(s);
        }
    }
    REP(i,v.size()-1) cout << v[i] << " ";
    cout << v.back() << endl;
    return 0;
}