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

// #define int long long

/* short */
#define pb push_back
#define print(Target) cout << Target << '\n'

/* REPmacro */
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

/* const */
const int INF = INT_MAX;

signed main()
{
  //ios::sync_with_stdio(false);
  string s;
  vector<string> dic, ans;

  while (cin >> s){
    dic.pb(s);
    char c;
    scanf("%c", &c);
    if (c == '\n') break;
  }
  bool flg = false;
  REP(i, dic.size()){
    REP(j, dic[i].size()){
      if (dic[i][j] == ',' || dic[i][j] == '.'){
        dic[i].erase(dic[i].begin() + j);
      }
    }
    if (3 <= dic[i].size() && dic[i].size() <= 6){
      ans.pb(dic[i]);
    }
  }
  REP(i, ans.size() - 1){
    cout << ans[i] << " ";
  }
  print(ans[ans.size() - 1]);
  
  return (0);
}