Prześlij pliki do 'TaskA04'
This commit is contained in:
parent
45163cade7
commit
5c79097202
6
TaskA04/description.txt
Normal file
6
TaskA04/description.txt
Normal 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
|
19939
TaskA04/polish_wiki_excerpt.exp
Normal file
19939
TaskA04/polish_wiki_excerpt.exp
Normal file
File diff suppressed because it is too large
Load Diff
BIN
TaskA04/polish_wiki_excerpt.in
Normal file
BIN
TaskA04/polish_wiki_excerpt.in
Normal file
Binary file not shown.
29
TaskA04/run.py
Normal file
29
TaskA04/run.py
Normal 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
4
TaskA04/simple.exp
Normal file
@ -0,0 +1,4 @@
|
||||
34234 34 5
|
||||
34535
|
||||
34
|
||||
1992 1999
|
Loading…
Reference in New Issue
Block a user