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: Accepted

Solution code:
import re

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

Submission status: Accepted

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

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(' '.join(map(str,ans)))

Submission status: Accepted

Solution code:
wordlist = list(map(str, input().split()))

newwordlist = []
for i, word in enumerate(wordlist):
    newword = word
    if word[-1] == ",":
        newword = word.replace(',', '')
    elif word[-1] == ".":
        newword = word.replace('.', '')
    if 3 <= len(newword) <= 6:
        newwordlist.append(newword)

print(' '.join(newwordlist))

Submission status: Accepted

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

Submission status: Runtime Error

Solution code:
while True:
		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,
		
	print ""

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    print(s[i], end = " ")
  else :
    pass

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    if(i == sl) :
      print(s[i])
    else :
      print(s[i], end = " ")
  else :
    pass

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    if(i == sl - 1) :
      print(s[i])
    else :
      print(s[i], end = " ")
  else :
    pass

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    print(s[i], end = " ")
  else :
    pass

print()

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    print(s[i], end = " ")
  else :
    pass

print("\n")

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    print(s[i], end = " ")
  else :
    pass

print('''
''')

Submission status: WA: Presentation Error

Solution code:
import re

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

for i in range(sl) :
  if(2 < len(s[i]) and len(s[i]) < 7) :
    if(i == 0) :
      print(s[i], end = "")
    else :
      print(" ", s[i], sep = "", end = "")
  else :
    pass

Submission status: WA: Presentation Error

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) :
    print(ans[i])
  else :
    print(ans[i], end = (" "))

Submission status: WA: Presentation Error

Solution code:
import re

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

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

Submission status: WA: Presentation Error

Solution code:
import sys

line = raw_input()
word_list = line.translate(None, '.,').split()
for i, word in enumerate(word_list):
    if len(word) >= 3 and len(word) <= 6:
        if i != 0:
            sys.stdout.write(" ")
        sys.stdout.write(word)
sys.stdout.write('\n')

Submission status: WA: Presentation Error

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 + " "
print ans

Submission status: WA: Presentation Error

Solution code:
while True:
	try:
		code = raw_input()
	except EOFError:
		break
	
	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: WA: Presentation Error

Solution code:
while True:
	try:
		code = raw_input()
	except EOFError:
		break
	
	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,
		
	print ""

Submission status: WA: Presentation Error

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,
		
print ""

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

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

Submission status: WA: Presentation Error

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