Problem:


検索エンジン

インターネットの検索エンジン、例えば、Google などでは、世界中のウェブページを自動で収捨して分類し、巨大なデータベースを作成します。また、ユーザが入力した検索キーワードを解析して、データベース検索のための問い合わせ文を作成します。

いずれの場合も、効率的な検索を実現するために複雑な処理を行っていますが、とりあえずの基本は全て文章からの単語の切り出しです。

ということで、文章からの単語の切り出しに挑戦してください。今回は以下の通り、単語区切りが明確な英語の文章を対象とします。

	対象となる文章　：　改行を含まない 1024 文字以下の英語の文章 

	区切り文字 ：　いずれも半角で空白、ピリオド、カンマのみ

	切り出す単語　：　3 から 6 文字の単語（2文字以下や7文字以上の単語は無視）　

入力

区切り文字及び英数字で構成される英文が１行（すべて半角）に与えられます。

出力

空白文字１文字（半角）で区切られた単語を１行に出力してください。

Sample Input

Rain, rain, go to Spain.

Output for the Sample Input

Rain rain Spain

Sample Input 2

Win today's preliminary contest and be qualified to visit University of Aizu.

Output for the Sample Input 2

Win and visit Aizu



Sample input:
Rain, rain, go to Spain.


Sample output:
Rain rain Spain

Submission status: Wrong Answer

Solution code:
import re

s = re.split("[ .,]", input())
sl = len(s)
ans = list()

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    ans.append(s[i])
  else :
    pass

ansl = len(ans)
for i in range(ansl - 1) :
  if(i == ansl) :
    print(ans[i])
  else :
    print(ans[i], end = (" "))

Submission status: Wrong Answer

Solution code:
import re

s = re.split("[ .,]", input())
sl = len(s)
ans = list()

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    ans.append(s[i])
  else :
    pass

ansl = len(ans)
print(ansl)
for i in range(ansl) :
  if(i == ansl - 1) :
    print(ans[i])
  else :
    print(ans[i], end = (" "))

Submission status: Wrong Answer

Solution code:
s = raw_input().split()
ans = []
for word in s:
    if 2 < len(word) < 7:
        ans.append(word.strip('.,'))
print ' '.join(map(str,ans))

Submission status: Wrong Answer

Solution code:
s = raw_input().split()
ans = []
for word in s:
    if 2 < len(word) < 7:
        ans.append(word.strip(',').strip('.'))
print ' '.join(map(str,ans))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-

str = raw_input()
str = str.replace(',',' ')
str = str.replace('.',' ')
strs = str.split()
ans = ""
for out in strs:
	ans += out + " "
print ans

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-

str = raw_input()
str = str.replace(',',' ')
str = str.replace('.',' ')
strs = str.split()
ans = ""
for out in strs:
	if(len(out) >3 and len(out) < 6 ):
		ans += out + " "
print ans

Submission status: Wrong Answer

Solution code:
l=map(str,raw_input().split())
for i in l:
    tmp=i.replace(',','')
    tmp=i.replace('.','')
    if 2<len(tmp)<7:
        print tmp,

Submission status: Wrong Answer

Solution code:
import re
string = input()
string = re.split(r"[ :,;.]",string)
words=[]
for i in string:
	if 3<=len(i)<6:
		words.append(i)
print(" ".join(words))

Submission status: Wrong Answer

Solution code:
print(' '.join([w for w in input().replace(',', '').replace('.', '').split(', ') if len(w) > 2 and len(w) < 7]))

Submission status: Wrong Answer

Solution code:
print(*filter(lambda x: 2 < len(x) < 7, input().strip(",.").split()))

Submission status: Wrong Answer

Solution code:
s=input()
n = s.split(" ")

x=""
for a in n:
    if a.find("'") and 2<len(a)<7:
        if a[-1]=="," or a[-1]==".":
            x+=(a[:-1]+" ")
        else:
            x+=(a+" ")

print(x[:-1])

Submission status: Wrong Answer

Solution code:
s=input()
n = s.split(" ")

x=""
for a in n:
    if a.find("'") and 2<len(a)<7:
        if a[-1]=="," or a[-1]==".":
            x+=(a[:-1]+" ")
        else:
            x+=(a+" ")

print(x)

Submission status: Wrong Answer

Solution code:
s=input()
n = s.split(" ")

x=""
for a in n:
    if a.find("'") and 2<len(a)<7:
        if a[-1]=="," or a[-1]==".":
            x+=(a[:-1]+" ")
        else:
            x+=(a+" ")
print(x[:-1]+"\n")

Submission status: Wrong Answer

Solution code:
msg = map(str, raw_input().replace(",","").replace(".","").split())
a = ""
for w in msg:
	if 2 < len(w) < 7: print w;

Submission status: Accepted

Solution code:
sent = input()
sent = sent.replace("."," ")
sent = sent.replace(","," ")
words = sent.split()
words = [i for i in words if len(i) <= 6]
words = [i for i in words if len(i) > 2]
print(*words,sep=" ")

Submission status: Accepted

Solution code:
import re

s = re.split("[ .,]", input())
sl = len(s)
ans = list()

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    ans.append(s[i])
  else :
    pass

ansl = len(ans)

for i in range(ansl) :
  if(i == ansl - 1) :
    print(ans[i])
  else :
    print(ans[i], end = (" "))

Submission status: Accepted

Solution code:
import re
s = raw_input()
for e in filter(lambda w: 2 < len(w) < 7, re.split(r'\s|,|\.',s) ):
    print e,

Submission status: Accepted

Solution code:
import sys
f = sys.stdin

import re

print(*[word for word in re.split(r'\s|,|\.', f.readline()) if 3 <= len(word) <= 6])

Submission status: Accepted

Solution code:
import re

s = re.split("[ .,]", raw_input())

for i in s:
	d = len(i)
	if d >= 3 and d <= 6:
		print i,

Submission status: Accepted

Solution code:
while True:
    result = []
    try:
        sentence = raw_input()
        s_i = None
        for i, c in enumerate(sentence):
            if s_i == None:
                s_i = i
            if c == ' ' or c == ',' or c == '.':
                if 3 <= len(sentence[s_i:i]) <= 6:
                    result.append(sentence[s_i:i])
                s_i = None
        else:
            print ' '.join(result)
    except EOFError:
        break

Submission status: Accepted

Solution code:
import sys

line = raw_input()
word_list = line.translate(None, '.,').split()
ans = []
for word in word_list:
    if len(word) >= 3 and len(word) <= 6:
        ans.append(word)

for i, w in enumerate(ans):
    if i != 0:
        sys.stdout.write(" ")
    sys.stdout.write(w)
sys.stdout.write("\n")

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-

str = raw_input()
str = str.replace(',',' ')
str = str.replace('.',' ')
strs = str.split()
ans = ""
for out in strs:
	if(len(out) > 2 and len(out) < 7 ):
		ans += out + " "
ans = ans.rstrip(" ")
print ans

Submission status: Accepted

Solution code:
code = str(raw_input())
	
code = code.replace(",","")
code = code.replace(".","")
code = code.split()
	
list = []
	
for var in code:
	if len(var) >= 3 and len(var) <= 6:
		list.append(var)
			
for var in list:
	print var,

Submission status: Accepted

Solution code:
code = raw_input()
code = code.replace(",","")
code = code.replace(".","")
code = code.split()
	
list = []
	
for var in code:
	if len(var) >= 3 and len(var) <= 6:
		list.append(var)
			
for var in list:
	print var,

Submission status: Accepted

Solution code:
l=map(str,raw_input().split())
for i in l:
    i=i.replace(',','')
    i=i.replace('.','')
    if 2<len(i)<7:
        print i,

Submission status: Accepted

Solution code:
import re
string = input()
string = re.split(r"[ :,;.]",string)
words=[]
for i in string:
	if 3<=len(i)<=6:
		words.append(i)
print(" ".join(words))

Submission status: Accepted

Solution code:
import re
ans = []
for w in re.split(r"[ ,.]",input()):
    if 3 <= len(w) <= 6:
        ans.append(w)
print(" ".join(ans))

Submission status: Accepted

Solution code:
print(' '.join([w for w in input().replace(',', '').replace('.', '').split(' ') if len(w) > 2 and len(w) < 7]))

Submission status: Accepted

Solution code:
import sys

for line in sys.stdin:
    line = list(map(str, line.strip().split()))
    ans = [l.strip(",.") for l in line if len(l.strip(",.")) < 7 and len(l.strip(",.")) > 2]
    print(' '.join(ans))

Submission status: Accepted

Solution code:
print(' '.join([x for x in input().replace(',','').replace('.','').split() if 2<len(x)<7]))

Submission status: Accepted

Solution code:
import re
s = input().strip()
t=re.split(r'[ .,]', s)
u=filter(lambda x:2<len(x)<7, t)
print(' '.join(u))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math

for s in sys.stdin:
    s = s.strip()
    s = s.replace(',', ' ')
    s = s.replace('.', ' ')
    words = s.split()
    words = [word for word in words if 3 <= len(word) <= 6]
    print(*words)

Submission status: Accepted

Solution code:
print(*list(filter(lambda x: 2 < len(x) < 7, input().replace(",", " ").replace(".", " ").split())))

Submission status: Accepted

Solution code:
print(*filter(lambda x: 2 < len(x) < 7, input().replace(",", "").replace(".", "").split()))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0084
"""
import sys


def main(args):
    words = []
    words = [x.strip(',.') for x in input().split(' ')]

    result = [x for x in words if 2 < len(x) < 7]
    print(' '.join(result))


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
# Aizu Problem 0084: Search Engine
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")

letters = [chr(_) for _ in range(65, 91)] + [chr(_) for _ in range(97, 123)]

def search_engine(string):
    for char in ['.', ',']:
        string = string.replace(char, ' ')
    words = [word for word in string.split() if 3 <= len(word) <= 6 and word.isalpha]
    print(' '.join(words))

    
for line in sys.stdin:
    search_engine(line.strip())

Submission status: Accepted

Solution code:
import re
s = filter(lambda s: 7 >len(s) > 2, re.split(r'\s|"|,|\.', input()))
print(*s)

Submission status: Accepted

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

words = input().split()
ans = ""
flag = True
for i in range(len(words)):
    s = words[i]
    s = s.replace(" ","")
    s = s.replace(",","")
    s = s.replace(".","")
    if len(s) > 2 and len(s) < 7:
        if flag:
            ans = s
            flag = False
        else:
            ans = ans + " " + s
print(ans)

Submission status: Accepted

Solution code:
a=''
for w in input().split():
 w=w.strip('.,')
 if 2<len(w)<7:a+=' '+w
print(a[1:])

Submission status: Accepted

Solution code:
a=[]
for w in input().split():
 w=w.strip('.,')
 if 2<len(w)<7:a+=[w]
print(*a)

Submission status: Accepted

Solution code:
print(*[x for x in input().replace(',','').replace('.','').split()if 2<len(x)<7])

Submission status: Accepted

Solution code:
print(*filter(lambda x:2<len(x)<7,input().replace(',','').replace('.','').split()))

Submission status: Accepted

Solution code:
print(*[w for w in map(lambda x:x.strip('.,'),input().split())if 2<len(w)<7])

Submission status: Accepted

Solution code:
print(*filter(lambda x:2<len(x)<7,map(lambda x:x.strip('.,'),input().split())))

Submission status: Accepted

Solution code:
import re
print(*filter(lambda s:2<len(s)<7,re.split(r'\s|"|,|\.',input())))

Submission status: Accepted

Solution code:
import re
print(*[x for x in re.split(r'\s|"|,|\.',input())if 2<len(x)<7])

Submission status: Accepted

Solution code:
ss = input()
ss = ss.replace(",", " ")
ss = ss.replace(".", " ")
print(*[s for s in ss.split() if 3 <= len(s) <= 6])

Submission status: Accepted

Solution code:
import re
print(" ".join([i for i in re.split("[,.\s]",input()) if 3<=len(i)<=6]))

Submission status: Accepted

Solution code:
# AOJ 0084 Search Engine
# Python3 2018.6.15 bal4u

import re

s = re.split('[., ]', input())
ans = []
for i in s:
	if len(i) >= 3 and len(i) <= 6:
		ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
# AOJ 0084 Search Engine
# Python3 2018.6.15 bal4u

import re

s = re.split('[., ]', input())
ans = []
for i in s:
	if 3 <= len(i) <= 6:
		ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
s=raw_input()
s=s.replace(",","")
s=s.replace(".","")
s=s.split()
s=[w for w in s if 3<=len(w)<=6]
print " ".join(s)

Submission status: Accepted

Solution code:
print " ".join(filter(lambda x:2<len(x)<7,raw_input().replace(","," ").replace("."," ").split()))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
import re

print(*(w for w in re.split('[ .,]', stdin.read()) if 2 < len(w) < 7))

Submission status: Accepted

Solution code:
import re

print ' '.join([s for s in re.split('[ .,]*',raw_input().strip()) if 2 < len(s) and len(s) < 7])

Submission status: Accepted

Solution code:
while True:
	try:
		msg = map(str, raw_input().split())
		ans = []
		for word in msg:
			if word[-1] == "," or word[-1] == ".":
				word = word[:-1]
			if 3 <= len(word) <= 6:
				ans.append(word)
		print " ".join(map(str, ans))
	except:
		break

Submission status: Accepted

Solution code:
while True:
	try:
		msg = map(str, raw_input().replace(",","").replace(".","").split())
		ans = []
		for word in msg:
			if 3 <= len(word) <= 6:
				ans.append(word)
		print " ".join(map(str, ans))
	except:
		break

Submission status: Accepted

Solution code:
msg = map(str, raw_input().replace(",","").replace(".","").split())
ans = []
for word in msg:
	if 2 < len(word) < 7:
		ans.append(word)
print " ".join(map(str, ans))

Submission status: Accepted

Solution code:
msg = map(str, raw_input().replace(",","").replace(".","").split())
ans = ""
for word in msg:
	if 2 < len(word) < 7:
		ans += word+" "
print ans[:-1]

Submission status: Accepted

Solution code:
msg = map(str, raw_input().replace(",","").replace(".","").split())
a = ""
for w in msg:
	if 2 < len(w) < 7: a += w+" "
print a[:-1]

Submission status: Accepted

Solution code:
msg = map(str, raw_input().replace(",","").replace(".","").split())
print " ".join(filter(lambda w:2<len(w)<7, msg))

Submission status: Accepted

Solution code:
s=raw_input()
s=s.replace(","," ")
s=s.replace("."," ")
for w in s.split():
  if 3<=len(w)<=6:print w,
print

Submission status: Accepted

Solution code:
s=raw_input().replace(","," ").replace("."," ").split()
s=" ".join([w for w in s if 2<len(w)<7])
print s

Submission status: Accepted

Solution code:
s=" "
x=raw_input().replace(",",s).replace(".",s).split()
print s.join([w for w in x if 2<len(w)<7])

Submission status: Accepted

Solution code:
s=" "
x=raw_input().replace(",",s).replace(".",s).split()
x=s.join([w for w in x if 2<len(w)<7])
print x

Submission status: Accepted

Solution code:
char = raw_input().split()
ans = []
for c in char:
	if ',' in c:
		c = c.replace(',','')
	elif '.' in c:
		c = c.replace('.','')
	if 3 <= len(c) <= 6:
		ans.append(c)
print " ".join(ans)

Submission status: Accepted

Solution code:
import re
print ' '.join(filter(lambda a: 3 <= len(a) <= 6, re.split('[ ,.]', raw_input())))

Submission status: Accepted

Solution code:
import re
ans = []
for w in re.split(r"[ ,.]",input()):
    if 3 <= len(w) <= 6:
        ans.append(w)
print(" ".join(ans))

Submission status: Accepted

Solution code:
import re
ans=[]
for w in re.split(r"[ ,.]",input()):
    if 3<=len(w)<=6:
        ans.append(w)
print(" ".join(ans))

Submission status: Accepted

Solution code:
s = list(input())

c = 0
n = [] 
ans = [] 
for i in range(len(s)):
    if s[i] == "," or s[i] == "." or s[i] == " ":
        if c >= 3 and c <= 6:
            ans = ans + n + [" "] 
        n.clear()
        c = 0

    else:
        n.append(s[i])
        c += 1
del ans[-1] 
for i in range(len(ans)) :
    print(ans[i], end="")
print()

Submission status: Accepted

Solution code:
import re

s = re.split('[., ]',input())
ans=[]
for i in s:
    if 3<= len(i) <=6:
        ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
import re 
word = re.split('[., ]',input())
ans = []
for i in word:
    if len(i) >= 3 and len(i) <= 6:
        ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
n=list(input())
a=[] 
b=[] 
c=0
for i in range(len(n)):
    if n[i]=="," or n[i]=="." or n[i]==" ":
        if 6>=c>=3:
            b=b+a+[" "]
        a.clear()
        c=0
    else:
        a.append(n[i])
        c+=1
del b[-1]
for i in range(len(b)):
   print(b[i],end="")
print()

Submission status: Accepted

Solution code:
l = str(input());
s = l.split(',');
a = ''.join(s);
b = a.split('.');
c = ''.join(b);
d = c.split(' ');
L = [];
for i in range(0,len(d)):
    if len(d[i]) >= 3 and len(d[i]) <= 6:
        L.append(d[i]);
        
print(' '.join(L));

Submission status: Accepted

Solution code:
a = input()
a = a.replace(","," ")
a = a.replace("."," ")
a = a.split()

b = []
for i in range(len(a)):
    if len(a[i])>=3 and len(a[i])<=6:
        b.append(a[i])
print(*b)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

s = list(input())
c = 0
n = [] 
ans = [] 
for i in range(len(s)):
    if s[i] == "," or s[i] == "." or s[i] == " ":
        if c >= 3 and c <= 6:
            ans = ans + n + [" "] 
        n.clear()
        c = 0
    else:
        n.append(s[i])
        c += 1

del ans[-1] 
for i in range(len(ans)):
   print(ans[i], end = "")
print("")

Submission status: Accepted

Solution code:
import re
s = input()
s = s.replace(",", "")
s = s.replace(".", "")
list = s.split(" ")
l = []
for i in range(len(list)):
    if 3 <= len(list[i]) <= 6:
        l.append(list[i])
print(*l)

Submission status: Accepted

Solution code:
a=input()
a=a.replace(","," ")
a=a.replace("."," ")
a=a.split()

b=[]
for i in range(len(a)):
    if len(a[i])>=3 and len(a[i])<=6:
       b.append(a[i])

print(*b)

Submission status: Accepted

Solution code:
a=input().split()
b=[]

for i in range(len(a)):
    a[i]=a[i].replace(",", "")
    a[i]=a[i].replace(".", "")
    if 3<=len(a[i])<=6:
        b.append(a[i])
print(*b)

Submission status: Accepted

Solution code:
import sys
try:
    a=list(map(str,input().split()))
except EOFError:
    sys.exit()
b=[]
for i in range(len(a)):
    if "," in a[i]:
        a[i]=a[i].replace(',', '')
    elif "." in a[i]:
        a[i]=a[i].replace('.', '')
    if len(a[i])>=3 and len(a[i])<=6:
        b.append(a[i])
b=' '.join(b)
print(b)

Submission status: Accepted

Solution code:
ss=input()
ss=ss.replace(","," ")
ss=ss.replace("."," ")
print(*[s for s in ss.split() if 3<=len(s)<=6])

Submission status: Accepted

Solution code:
import re
a = input()
l = re.split('[ .,]', a)
m =[]
for i in l:
  if 2 < len(i) < 7:
    m.append(i)
print(" ".join(m))

Submission status: Accepted

Solution code:
n=input()
n=n.split()
N=len(n)
B=[]
C=[s.strip(',') for s in n]
C=[s.strip('.') for s in C]
for i in range(N):
    A=len(C[i])
    if A>=3 and A<=6:
        B.append(C[i])
print(*B)

Submission status: Accepted

Solution code:
a=input()
a=a.replace(","," ")
a=a.replace("."," ")
a=a.split()

li=[]
for i in range(len(a)):
    if len(a[i])>=3 and len(a[i])<=6:
       li.append(a[i])

print(*li)

Submission status: Accepted

Solution code:
import sys, re
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    s = readline().strip()
    ans = []
    for w in re.split("[ .,]", s):
        if 3 <= len(w) <= 6:
            ans.append(w)
    write(" ".join(ans))
    write("\n")
solve()

Submission status: Accepted

Solution code:
#86 サーチエンジン

import re

s = re.split('[., ]',input())
ans = []
for i in s:
    if 2 < len(i) < 7:
        ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a=input()
a=a.replace(","," ")
a=a.replace("."," ")
print(*[s for s in a.split() if 3<=len(s)<=6])

Submission status: Accepted

Solution code:
import re

while 1:
    try:
        n = input()
        a = re.split('[,. ]', n)
        ans = []
        for i in a:#a[i]
            if 3 <= len(i) <= 6:
                ans.append(i)
        print(*ans)
    except:
        break

Submission status: Accepted

Solution code:
w=input()
w=w.replace(",","")
w=w.replace(".","")

list=w.split(' ')
l=[]
for i in range(len(list)):
    if len(list[i])>=3 and len(list[i])<=6:
        l.append(list[i])
print(*l)

Submission status: Accepted

Solution code:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


input_str = input()

length = 0
work = deque()
is_First = True

for i in range(len(input_str)):
    ch = input_str[i]
    if ch in [' ',',','.'] or i == len(input_str)-1: #区切り文字または最後の文字
        if length >= 3 and length <= 6:
            if is_First == False:
                print(" ",end="")

            while len(work) > 0:
                print("%s"%(work.popleft()),end="")
            is_First = False
        else:
            while len(work) > 0:
                work.popleft()
        length = 0
    else:
        work.append(ch)
        length += 1
print()

Submission status: Accepted

Solution code:
# 85
a = input().split()

b = []

for i in range(len(a)):
    a[i] = a[i].replace(",", "")
    a[i] = a[i].replace(".", "")
    if 3 <= len(a[i]) <= 6:
        b.append(a[i])
print(*b)

Submission status: Accepted

Solution code:
import re
n=input()
s=re.split('[,. ]', n)
a=[]
for i in s:
    if 3<=len(i)<=6:
        a.append(i)
print(*a)

Submission status: Accepted

Solution code:
x=input()
X=x.replace(","," ")
X=X.replace("."," ")
A=X.split()
ans=[]
for i in range(len(A)):
    if 3<=len(A[i])<=6:
        ans.append(A[i])
    else:
        pass
print(*ans)

Submission status: Accepted

Solution code:
kensaku=list(input())
moji=0
n=[]
ans=[]
for i in range(len(kensaku)):
    if kensaku[i]==' ' or kensaku[i]=='.' or kensaku[i]==',':
        if 3<=moji<=6:
            ans=ans+n+[' ']
        n.clear()
        moji=0
    else:
        n.append(kensaku[i])
        moji+=1
del ans[-1]
for i in range(len(ans)):
    print(ans[i],end='')
print()

Submission status: Accepted

Solution code:
n = input()
m = n.replace(',', '')
l = m.replace('.', '')
L = l.split()
x = []
for i in L:
    if 3 <= len(i) <=6 :
        x.append(i)
print(*x)

Submission status: Accepted

Solution code:
import sys, re
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    s = readline().strip()
    ans = []
    for w in re.split("[ .,]", s):
        if 3 <= len(w) <= 6:
            ans.append(w)
    write(" ".join(ans))
    write("\n")
solve()

Submission status: Accepted

Solution code:
import re
n=input()
k=re.split("[ ,.]", n)
j=0

for i in range(len(k)):
    if len(k[i])>=3 and len(k[i])<=6:
        if j!=0:
            print(" ", end="")
        print(k[i], end="")
        j+=1

print("")

Submission status: Accepted

Solution code:
import re
x = input()
s = re.split('[ ,.]', x)
p=[]
for i in range(len(s)):
   if len(s[i])>=3 and len(s[i])<=6:
      p.append(s[i])
   else:
      pass
p = ' '.join(p)
print(p)

Submission status: Accepted

Solution code:
a = input()
a = a.replace(",", " ")
a = a.replace(".", " ")
print(*[s for s in a.split() if 3 <= len(s) <= 6])

Submission status: Accepted

Solution code:
n=str(input())
n=n.replace(',' , ' ')
n=n.replace('.' , ' ')
n=n.split()
s=[]
for i in n:
    if 3<=len(i) and len(i)<=6:
        s.append(i)
print(*s)

Submission status: Accepted

Solution code:
s = input().split()
ans = []
for i in s:
    if i[-1] == ',' or i[-1] == '.':
        if 4 <= len(i) <=7:
            ans.append(i[:-1])
    else:
        if 3 <= len(i) <= 6:
            ans.append(i)

print(*ans)

Submission status: Accepted

Solution code:

import re
a = re.split('[,. ]', input())

ans = []
for i in a:
    if 2<len(i)<7: ans.append(i)
    
print(*ans)

Submission status: Accepted

Solution code:
import re

I = input().split()
S = []

for i in range(len(I)) :
    I[i] = re.split("[,.]", I[i])
    if 2 < len(I[i][0]) and len(I[i][0]) < 7 :
        S.append(I[i][0])

for i in range(len(S)) :
    if i == len(S) - 1 :
        print(S[i])
    else :
        print(S[i], " ", sep = "", end = "")

Submission status: Accepted

Solution code:
# coding: utf-8
# 86

a = input()
A = a.replace(',','')
B = A.replace('.','')
#print(B)
C=B.split()
#print(C)
#print(len(C))
R=[]
for i in range(len(C)):
    if len(C[i])>2 and len(C[i])<7:
       R.append(C[i])

print(*R)

Submission status: Accepted

Solution code:
import re
a = str(input())
b = re.split('[,. ]',a)
c = len(b)
d = []
for i in range(c):
    e = b[i]
    if len(e) >= 3 and len(e) <= 6:
        d.append(e)
f = ' '.join(d)
print(f)

Submission status: Accepted

Solution code:
import re

s=re.split('[., ]',input())
ans=[]
for i in s:
    if 3<=len(i)<=6:
        ans.append(i)

print(*ans)

Submission status: Accepted

Solution code:
L=str(input())
L=L.replace(", ",",")
L=L.replace(" ",",")
L=L.replace(".","")
M=L.split(",")
N=list(M)
l=len(N)
A=[]

for i in range(l):
    m=len(N[i])
    
    if i==l-1:
        m=m-1
    
    if 3<=m<=6:
        A.append(N[i])
    
a=len(A)
for j in range(a):
    if j<a-1:
        print(A[j],end=" ")
    else:
        print(A[j])

Submission status: Accepted

Solution code:
import re
d = input()

lst = re.split('[ ,.]',d)

p = []

for i in range(len(lst)):
    if len(lst[i]) >= 3 and len(lst[i]) <= 6:
        p.append(lst[i])
    
p = ' '.join(p)
print(p)

Submission status: Accepted

Solution code:
x=input()
x=x.replace(","," ")
x=x.replace("."," ")
ans=[]
for i in x.split():
    if 3<=len(i)<=6:
        ans.append(i)
print(" ".join(ans))

Submission status: Accepted

Solution code:
a=input()
a=a.replace("."," ")
a=a.replace(","," ")
b=a.split()
l=[]
for i in range(len(b)):
    x=len(b[i])
    if 3<=x<=6:
        l.append(b[i])
print(" ".join(l))

Submission status: Accepted

Solution code:
import re
a = re.split('[,. ]',input())
b = []
for i in a:
    if 3 <= len(i) <= 6:
        b.append(i)
print(*b)

Submission status: Accepted

Solution code:
s = str(input())
n = s.replace(',','') #,のところをスペースに変える
o = n.replace('.','') #.のところをスペースに変える
m = o.split() #スペースごとに代入
a = []
for i in m:
    l = len(i)
    if l>=3 and l<=6:
        a.append(i)

print(*a)

Submission status: Accepted

Solution code:
a = input()
a = a.replace("."," ")
a = a.replace(","," ")
x = a.split()
y = []
for i in range(len(x)):
    if 3 <= len(x[i]) <= 6:
        y.append(x[i])
print(" ".join(y))

Submission status: Accepted

Solution code:
#0084
import re
x = str(input())
y = re.split('[, .]',x)
a = []

for i in range(len(y)):
    if 2 < len(y[i]) < 7:
        a.append(y[i])
print(*a)

Submission status: Accepted

Solution code:
a=input()
a1=a.replace(","," ")
a2=a1.replace("."," ")
A=a2.split()
B=[]
for i in range(len(A)):
    if 3<=len(A[i])<=6:
        B.append(A[i])
print(*B)

Submission status: Accepted

Solution code:
s=str(input())
s=s.replace(',', '')
s=s.replace('.','')
s=s.split()

m=[]
for i in range(len(s)):
    if len(s[i])>=3 and len(s[i])<=6:
        m.append(s[i])
print(*m)

Submission status: Accepted

Solution code:
import re
s=re.split('[., ]', input())
ans=[]
for i in s:
	if 3<=len(i)<=6:
		ans.append(i)
print(*ans)

Submission status: Accepted

Solution code:
s = list(input())
#print(s)

c = 0
n = [] 
ans = [] # -> 追加箇所
for i in range(len(s)):
    if s[i] == "," or s[i] == "." or s[i] == " ":
        if c >= 3 and c <= 6:
            #for j in range(len(n)):
            #    print(n[j], end = "")
            ans = ans + n + [" "] # ->追加箇所

        n.clear()
        c = 0

    else:
        n.append(s[i])
        c += 1
#print(ans)
del ans[-1] # ->追加箇所
#print(ans)
#print(*ans, sep="") # ->追加箇所
for i in range(len(ans)) :
    print(ans[i], end="")
print()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#ポイント：ピリオドで文章が終わるとは限らない。ピリオドが2つ続いてたらということを考える

s = list(input())
#print(s)
c = 0
n = [] 
ans = [] 
for i in range(len(s)):
    if s[i] == "," or s[i] == "." or s[i] == " ":
        if c >= 3 and c <= 6:
            ans = ans + n + [" "] #appendは使えない
        n.clear()
        c = 0
    else:
        n.append(s[i])
        c += 1

del ans[-1] #最後のスペースを削除
#print(*ans, sep = "")
for i in range(len(ans)):
   print(ans[i], end = "")
print("")

Submission status: Accepted

Solution code:
s = str(input())
n = s.replace(',','')
o = n.replace('.','')
m = o.split()

a = []
for i in m:
    l = len(i)
    if l>=3 and l<=6:
        a.append(i)

print(*a)

Submission status: Accepted

Solution code:
import re
a=input()
x=re.split('[, .]',a)
for i in range(len(x)):
    if len(x[i]) < 3 or len(x[i]) > 6:
        x[i]=0
y=list(x)
z=[n for n in y if n != 0]
print(*z)

Submission status: Accepted

Solution code:
n=input()
n=n.replace(","," ")
n=n.replace("."," ")
lst=n.split()
a=[]
for i in range(len(lst)):
    if 3<=len(lst[i])<=6:
        a.append(lst[i])
print(" ".join(a))

Submission status: Accepted

Solution code:
import re
s=re.split('[,. ]',input())

ans=[]
for i in s:
    if 2<len(i)<7:
        ans.append(i)

print(*ans)

Submission status: Accepted

Solution code:
text = input()

text = text.replace(',',' ')
text = text.replace('.',' ')
TEXT = []
for i in text.split():
    if 3<=len(i)<=6:
        TEXT.append(i)
print(' '.join(TEXT))

Submission status: Accepted

Solution code:
a = input()
a = a.replace("."," ")
a = a.replace(","," ")
x = a.split()
y = []
for i in range(len(x)):
    if 3 <= len(x[i]) <= 6:
        y.append(x[i])
print(" ".join(y))

Submission status: Accepted

Solution code:
s = input()
s = s.replace(",", " ")
s = s.replace(".", " ")
y=[]
for i in s.split():
    if 3<=len(i) and len(i)<=6:
        y.append(i)
print(' '.join(y))

Submission status: Accepted

Solution code:
try:
    while True:
        str = str(input())
        str_replace_period = str.replace(".",",")
        str_replace_space = str_replace_period.replace(" ",",")
        word = str_replace_space.split(",")
        i = 0
        word_list = ""
        while i < len(word) :
            if len(word[i]) >= 3 and len(word[i]) <= 6 :
                word_list = word_list + word[i] + " "
            i += 1
except EOFError:
    pass

if(word_list[-1:]==" "):
    print(word_list[:-1])
else:
    print(word_list)

Submission status: Accepted

Solution code:
while True:
    try:
        s=input()
        s=s.replace(","," ")
        s=s.replace("."," ")
        s=s.split(" ")
        ans=[]
        for w in s:
            if len(w)>=3 and len(w)<=6:
                ans.append(w)
        print(" ".join(ans))
    except EOFError:
        break

Submission status: Accepted

Solution code:
s = input().replace(",", " ").replace(".", " ")
print(*[s for s in s.split() if 3 <= len(s) <= 6])

Submission status: Accepted

Solution code:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


input_str = input()

length = 0
work = deque()
is_First = True

for i in range(len(input_str)):
    ch = input_str[i]
    if ch in [' ',',','.'] or i == len(input_str)-1: #区切り文字または最後の文字
        if length >= 3 and length <= 6:
            if is_First == False:
                print(" ",end="")

            while len(work) > 0:
                print("%s"%(work.popleft()),end="")
            is_First = False
        else:
            while len(work) > 0:
                work.popleft()
        length = 0
    else:
        work.append(ch)
        length += 1
print()

Submission status: Accepted

Solution code:
ans = []
s = input().replace(',', ' ').replace('.', ' ').split()
for m in s:
    if 3 <= len(m) and len(m) <= 6:
        ans.append(m)

print(*ans)

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    
    line = input().replace(".","").replace(",","").split()
    
    ans =  [i for i in line if 3 <= len(i) <= 6]
    print(*ans)