automata-labs/TaskA04/solution.py
2024-11-01 13:57:56 +01:00

25 lines
641 B
Python

import sys
def solve(lines):
res = []
for l in lines:
numbers = []
for w in l.split():
number = ''.join(filter(lambda c: c.isdigit(), w))
if number:
numbers.append(number)
if numbers:
res.append(' '.join(numbers) + '\n')
return res
if __name__ == "__main__":
lines = []
fp = sys.argv[1]
with open("../TaskA02/polish_wiki_excerpt.in", encoding="utf-8") as f:
lines = f.readlines()
sol = solve(lines)
with open("./polish_wiki_excerpt.out", 'w', encoding="utf-8") as f:
f.writelines(sol)