'use strict';

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function(line) {
  var keywords = extractKeywords(line.trim());
  console.log(keywords.join(' '));
});

function extractKeywords(line) {
  var words = line.split(/[ \.,]/);
  return words.filter(function(word) {
    return word.length >= 3 && word.length <= 6;
  });
}