//#define scanf_s scanf
#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 7
#define MIN 2
#define _MAX 1025
int main(void)
{
	char str[_MAX],ans[MAX];
	int year, mon, day, _cou = 0;
	int cou = 0;
	gets_s(str);
	for (int i = 0; str[i] != '\0'; ++i) {
		if ((str[i] == ' ' || str[i] == '.') || str[i] == ',') {
			if (2 < cou && cou < 7) {
				ans[cou] = '\0';
				if (_cou != 0) {
					printf(" ");
				}
				printf("%s", ans);
				++_cou;
			}
			cou = 0;
		}
		else {
			if (cou < 7) {
				ans[cou] = str[i];
			}
			++cou;
		}
	}
	printf("\n");
}