wykonane zadania z tasku D

This commit is contained in:
Veronika Polevara 2023-11-25 16:08:43 +01:00
parent 92b31192b3
commit f424d4529c
5 changed files with 40 additions and 0 deletions

6
TaskD04/description.txt Normal file
View File

@ -0,0 +1,6 @@
Write a program to find all maximum substrings of digits.
Return only these substrings separated by spaces in their order.
Do use regular expressions.
POINTS: 2
DEADLINE: 2023-11-26 23:59:59

21
TaskD04/run.py Normal file
View File

@ -0,0 +1,21 @@
import re
import sys
def remove_non_digits(line):
return re.sub(r'[^0-9\s]', '', line)
processed_lines = []
for line in sys.stdin:
processed_line = remove_non_digits(line)
processed_line = re.sub(r'^\s+|\s+$', '', processed_line)
processed_line = re.sub(r'\s+', ' ', processed_line)
digit_groups = re.findall(r'\d+', processed_line)
if digit_groups:
processed_lines.append(' '.join(digit_groups))
print('\n'.join(processed_lines), end='')

4
TaskD04/simple.exp Normal file
View File

@ -0,0 +1,4 @@
34234 34 5
34535
34
1992 1999

5
TaskD04/simple.in Normal file
View File

@ -0,0 +1,5 @@
34234 34 dfd gfd 5
34535
fsdflskfjsdflk
fsdkfj sdf34fdfd
The company was established in 1992 from the merger of Authorware, Inc. (creators of the Authorware package) and MacroMind-Paracomp (producer of Macromind Director). In 1999, Macromedia purchased Allaire and its bi

4
TaskD04/simple.out Normal file
View File

@ -0,0 +1,4 @@
34234 34 5
34535
34
1992 1999