#include <stdio.h>
#include <cmath>
#include <algorithm>

using namespace std;


int main(){

    char buf[1100],word[1100];
    int length = 0;

    fgets(buf,1100,stdin);
    bool firstFLG = true;

    for(int i=0;buf[i]!='\n' && buf[i] != '\0';i++){
    	if(buf[i] == ' ' || buf[i] == '.' || buf[i] == ','){
    		if(length >= 3 && length <= 6){
    			if(firstFLG){
    				printf("%s",word);
    				firstFLG = false;
    			}else{
    				printf(" %s",word);
    			}
    		}
    		length = 0;
    	}else{
    		word[length] = buf[i];
    		word[length+1] = '\0';
    		length++;
    		if(buf[i+1] == '\n'){
    			if(length >= 3 && length <= 6){
					if(firstFLG){
						printf("%s",word);
						firstFLG = false;
					}else{
						printf(" %s",word);
					}
				}
				length = 0;
    		}
    	}
    }
    printf("\n");

    return 0;
}