#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string s;
    getline(cin, s);
    rep(i, s.size()) if (s[i] == ',' || s[i] == '.') s[i] = ' ';
    stringstream ss(s);
    vector<string> ans;
    while (ss >> s)
        if (3 <= s.size() && s.size() <= 6)
            ans.push_back(s);

    rep(i, ans.size()) i != ans.size() - 1 ? cout << ans[i] << " " : OP(ans[i]);

    return 0;
}
