jfz-2023-s474155/TaskE06/run.py

20 lines
471 B
Python
Raw Permalink Normal View History

2023-12-09 17:11:00 +01:00
import re
import sys
def is5or6Digits(s):
pattern = re.compile(r'^[1-9]\d{4,5}$')
return bool(re.match(pattern, s))
inFile = sys.argv[1]
outFile = sys.argv[2]
# inFile = 'test.in'
# outFile = 'test.out'
with open(inFile, 'r', encoding='utf-8') as inputFile, open(outFile, 'w', encoding='utf-8') as outputFile:
for line in inputFile:
line = line.strip()
result = "yes" if is5or6Digits(line) else "no"
outputFile.write(result+'\n')