#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define MAX 1010

bool isSep(char c){
  return c == ' ' || c == ',' || c == '.' || c == '\n';
}

char buff[1200];
char tang[1000][7];

int main(){
  int cnt = 0, pos = 0;
  set<string> s;
  fgets(buff, sizeof(buff), stdin);
  for(char *p = buff; *p; p++){
    if(isSep(*p)){
      if(pos > 2 && pos < 7){
	tang[cnt][pos] = '\0';
	if(s.find(tang[cnt]) == s.end() || true){
	  s.insert(tang[cnt]);
	  cnt++;
	}
      }
      pos = 0;
    }else{
      if(pos < 7){
	tang[cnt][pos] = *p;
	pos++;
      }
    }
  }
  REP(i, cnt)
    printf("%s%c",tang[i],(i==cnt-1?'\n':' '));
  return 0;
}