Prześlij pliki do 'TaskA04'

This commit is contained in:
Yevheniia Kryzhanovska 2023-10-30 11:59:11 +01:00
parent 45163cade7
commit 5c79097202
5 changed files with 19978 additions and 0 deletions

6
TaskA04/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 not use regular expressions, just the simplest capabilities
of a programming language.
POINTS: 3

File diff suppressed because it is too large Load Diff

Binary file not shown.

29
TaskA04/run.py Normal file
View File

@ -0,0 +1,29 @@
def checkDigit(char):
digits=['1','2','3','4','5','6','7','8','9']
for j in range(len(digits)):
if char==digits[j]:
return char
return None
def checkMaxDigitsSub(fileToCheck):
with open(fileToCheck, "r", encoding="utf-8") as sampleCheck:
word = ''
previousChar=''
for row in sampleCheck:
for char in row:
if char == '\n':
if word != '':
print(word)
word = ''
if checkDigit(char):
if not checkDigit(previousChar):
word += ' '
word += char
previousChar = char
file = 'simple.exp'
checkMaxDigitsSub(file)

4
TaskA04/simple.exp Normal file
View File

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