Compare commits
No commits in common. "da203c4b6f525deb180a8ff6319e8ac0866386d0" and "b1e6a2a7f8a830d30e91294149f4750ae570e9db" have entirely different histories.
da203c4b6f
...
b1e6a2a7f8
@ -1,18 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def check_number_divisible_by_5(input_string):
|
|
||||||
pattern = r'^(hi){2,}\!*$'
|
|
||||||
|
|
||||||
if re.match(pattern, input_string):
|
|
||||||
print('yes')
|
|
||||||
else:
|
|
||||||
print('no')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
line = input()
|
|
||||||
check_number_divisible_by_5(line)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
@ -1,18 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def check_number_divisible_by_5(input_string):
|
|
||||||
pattern = r'.*[A-Z]\d{2}.*'
|
|
||||||
|
|
||||||
if re.match(pattern, input_string):
|
|
||||||
print('yes')
|
|
||||||
else:
|
|
||||||
print('no')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
line = input()
|
|
||||||
check_number_divisible_by_5(line)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
@ -1,18 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def check_number_divisible_by_5(input_string):
|
|
||||||
pattern = r'^(?!1-500-56773-4323)\d-\d{3}-\d{5}-\d{4}$'
|
|
||||||
|
|
||||||
if re.match(pattern, input_string):
|
|
||||||
print('yes')
|
|
||||||
else:
|
|
||||||
print('no')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
line = input()
|
|
||||||
check_number_divisible_by_5(line)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
@ -1,18 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def check_number_divisible_by_5(input_string):
|
|
||||||
pattern = r'^1(00)+$'
|
|
||||||
|
|
||||||
if re.match(pattern, input_string):
|
|
||||||
print('yes')
|
|
||||||
else:
|
|
||||||
print('no')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
line = input()
|
|
||||||
check_number_divisible_by_5(line)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
pass
|
|
@ -1,18 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def substitute_digits(match):
|
|
||||||
digit_mapping = {'0': 'a', '1': 'b', '2': 'c', '3': 'd', '4': 'e', '5': 'f', '6': 'g', '7': 'h', '8': 'i', '9': 'j'}
|
|
||||||
return ''.join([digit_mapping[d] for d in match.group()])
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
line = input()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
result = re.sub(r'\b\d{4}\b', substitute_digits, line)
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
break
|
|
@ -18,3 +18,5 @@ letter to lower. In this task word means the string of "\w" metacharacters,
|
|||||||
lower case letter is [a-ząćęłńóśźż] class,
|
lower case letter is [a-ząćęłńóśźż] class,
|
||||||
capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class.
|
capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class.
|
||||||
|
|
||||||
|
POINTS: 2
|
||||||
|
DEADLINE: 2020-12-18 23:59:59
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def swap_case(match):
|
|
||||||
return match.group().swapcase()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
line = input()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
result = re.sub(r'\b(?=\w*[a-ząćęłńóśźż])(?=\w*[A-ZĄĆĘŁŃÓŚŹŻ])\w+\b', swap_case, line)
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
break
|
|
@ -1,23 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def count_characters(category, line):
|
|
||||||
return len(re.findall(category, line))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
line = input()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
# Zliczanie małych liter, dużych liter, cyfr i pozostałych znaków osobno
|
|
||||||
lowercase_count = count_characters(r'[a-ząćęłńóśźż]', line)
|
|
||||||
uppercase_count = count_characters(r'[A-ZĄĆĘŁŃÓŚŹŻ]', line)
|
|
||||||
digit_count = count_characters(r'\d', line)
|
|
||||||
other_count = count_characters(r'[^a-ząćęłńóśźżA-ZĄĆĘŁŃÓŚŹŻ\d]', line)
|
|
||||||
|
|
||||||
result = f"{lowercase_count} {uppercase_count} {digit_count} {other_count}"
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
break
|
|
@ -19,3 +19,6 @@ In this task word means a string of "\w" metacharacters,
|
|||||||
lower case letter is [a-ząćęłńóśźż] class,
|
lower case letter is [a-ząćęłńóśźż] class,
|
||||||
capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class.
|
capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class capital case letter is [A-ZĄĆĘŁŃÓŚŹŻ] class.
|
||||||
|
|
||||||
|
|
||||||
|
POINTS: 1
|
||||||
|
DEADLINE: 2020-12-18 23:59:59
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
def count_characters(category, line):
|
|
||||||
return len(re.findall(category, line))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
line = input()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
lowercase_count = count_characters(r'\b[a-ząćęłńóśźż]\w*\b', line)
|
|
||||||
uppercase_count = count_characters(r'\b[A-ZĄĆĘŁŃÓŚŹŻ]\w*\b', line)
|
|
||||||
|
|
||||||
result = f"{lowercase_count} {uppercase_count}"
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
break
|
|
@ -16,3 +16,5 @@ Write the input line with the second digits string deleted.
|
|||||||
Digit is a [0-9] class.
|
Digit is a [0-9] class.
|
||||||
|
|
||||||
|
|
||||||
|
POINTS: 1
|
||||||
|
DEADLINE: 2020-12-18 23:59:59
|
||||||
|
@ -17,3 +17,6 @@ The number of "x" in the "xxx" string should be the same as the
|
|||||||
the number of characters in the input string.
|
the number of characters in the input string.
|
||||||
In this task, a word means a string of "\w" metacharacters.
|
In this task, a word means a string of "\w" metacharacters.
|
||||||
|
|
||||||
|
|
||||||
|
POINTS: 2
|
||||||
|
DEADLINE: 2020-12-18 23:59:59
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
line = input()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
|
|
||||||
result = re.sub(r'(\b\w+\b) (\b\w+\b) (\b\w+\b)', lambda match: f'{match.group(1)} {match.group(2)} {"x" * len(match.group(3))}', line)
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
except EOFError:
|
|
||||||
break
|
|
@ -1,20 +0,0 @@
|
|||||||
Use regular expressions to extract lines containing polish surnames.
|
|
||||||
|
|
||||||
Download list of polish male and female surnames from here:
|
|
||||||
|
|
||||||
|
|
||||||
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/35279/table?page=1&per_page=20&q=&sort=
|
|
||||||
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/22817/table?page=1&per_page=20&q=&sort=
|
|
||||||
|
|
||||||
|
|
||||||
Extract lines from stdin containing any of the surnames.
|
|
||||||
Look only for surnames in lowercase.
|
|
||||||
The surname does not have to be surrounded by space or any other special characters.
|
|
||||||
Don't search for declined forms of surnames.
|
|
||||||
|
|
||||||
Check either NFA (e.g. re python library) and DFA (google re2) and compare run speed.
|
|
||||||
|
|
||||||
Submit solution based on DFA library.
|
|
||||||
|
|
||||||
NOTE: You could extract the polish surnames list, save it to a file, then commit the file to your repository.
|
|
||||||
NOTE: You may set max_mem to a higher value than the default in re2 library.
|
|
File diff suppressed because one or more lines are too long
@ -1,41 +0,0 @@
|
|||||||
Use regular expressions to mark Polish first-person masculine forms.
|
|
||||||
|
|
||||||
You should handle the following types of expressions:
|
|
||||||
|
|
||||||
* first-person masculine past forms of verbs ("zrobiłem", "pisałem", etc.),
|
|
||||||
* first-person singular masculine forms of the verb "być" ("be") combined
|
|
||||||
with singular masculine nominative forms of adjectives ("wysoki", "sprytny", etc.),
|
|
||||||
assuming that the form of the verb "być" is to the left of the adjective, not
|
|
||||||
more than 3 other words,
|
|
||||||
* the verb "będę" combined with the past participle (i.e. 3rd person
|
|
||||||
masculine imperfect form, e.g. "robił", pisał"), assuming
|
|
||||||
that "będę" is to the left of the adjective, not
|
|
||||||
more than 3 other words to the left of the participle OR directly
|
|
||||||
to the right of the participle ("robił będę").
|
|
||||||
|
|
||||||
The first-person masculine forms should be marked with curly brackets.
|
|
||||||
You should mark only the masculine form. Do not mark the form of "być"
|
|
||||||
(unless it clearly a masculine form, i.e. for "byłem").
|
|
||||||
|
|
||||||
The match should be case-insensitive.
|
|
||||||
|
|
||||||
The PoliMorf dictionary of inflected forms should be applied:
|
|
||||||
http://zil.ipipan.waw.pl/PoliMorf?action=AttachFile&do=get&target=PoliMorf-0.6.7.tab.gz
|
|
||||||
|
|
||||||
Suggested steps:
|
|
||||||
|
|
||||||
1. Extract all the needed forms from the PoliMorf dictionary:
|
|
||||||
|
|
||||||
* 1st person masculine past forms of verbs, unfortunately
|
|
||||||
this form is not directly present in the lexicon, you need
|
|
||||||
to add "em" to the 3rd person masculine form ("zrobił" => "zrobiłem")
|
|
||||||
* singular masculine nominative forms of adjectives
|
|
||||||
* masculine past participle (3rd person masculine imperfect forms of verbs)
|
|
||||||
|
|
||||||
You could do this using grep/cut commands — to obtain a simple text files
|
|
||||||
with a word in each line. You can do this once and commit the 3 files to your repository.
|
|
||||||
|
|
||||||
2. In your `run` script/program, read the 3 files and create a large
|
|
||||||
expression with alternatives. Use a regexp library based on DFAs (determintistic
|
|
||||||
finite-automatons).
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
Tu nic nie ma.
|
|
||||||
Wczoraj {ugotowałem} ziemniaki.
|
|
||||||
{Jechałem}, {jechałem} i {jechałem}, a potem się {zatrzymałem}.
|
|
||||||
{Umyłem} się mydłem.
|
|
||||||
Jestem {wysoki}.
|
|
||||||
Jest wysoki.
|
|
||||||
Mówią, że jestem od zawsze niezwykle {sprytny}.
|
|
||||||
aaaa {byłem} aaa {zielony} ddd
|
|
||||||
aaaa {byłem} aaa bbb {zielony} ddd
|
|
||||||
aaaa {byłem} aaa bbb ccc {zielony} ddd
|
|
||||||
aaaa {byłem} aaa bbb ccc ddd zielony ddd
|
|
||||||
aaaa był aaa bbb zielony ddd
|
|
||||||
aaaa byłam aaa bbb zielony ddd
|
|
||||||
aaaa byłam aaa bbb zielona ddd
|
|
||||||
teraz będę {pisał} książkę
|
|
||||||
będę teraz {pisał} książkę
|
|
||||||
będę teraz dla ciebie {pisał} książkę
|
|
||||||
teraz dla ciebie {pisał} będę księżkę
|
|
||||||
będę i on napisał książkę
|
|
||||||
aaa będę {śpiewał} bbb
|
|
||||||
aaa będę ccc {śpiewał} bbb
|
|
||||||
aaa będę ccc ddd {śpiewał} bbb
|
|
||||||
aaa będę ccc ddd eee {śpiewał} bbb
|
|
||||||
aaa będę ccc ddd eee fff śpiewał bbb
|
|
||||||
{pływałem} i {biegałem}
|
|
@ -1,25 +0,0 @@
|
|||||||
Tu nic nie ma.
|
|
||||||
Wczoraj ugotowałem ziemniaki.
|
|
||||||
Jechałem, jechałem i jechałem, a potem się zatrzymałem.
|
|
||||||
Umyłem się mydłem.
|
|
||||||
Jestem wysoki.
|
|
||||||
Jest wysoki.
|
|
||||||
Mówią, że jestem od zawsze niezwykle sprytny.
|
|
||||||
aaaa byłem aaa zielony ddd
|
|
||||||
aaaa byłem aaa bbb zielony ddd
|
|
||||||
aaaa byłem aaa bbb ccc zielony ddd
|
|
||||||
aaaa byłem aaa bbb ccc ddd zielony ddd
|
|
||||||
aaaa był aaa bbb zielony ddd
|
|
||||||
aaaa byłam aaa bbb zielony ddd
|
|
||||||
aaaa byłam aaa bbb zielona ddd
|
|
||||||
teraz będę pisał książkę
|
|
||||||
będę teraz pisał książkę
|
|
||||||
będę teraz dla ciebie pisał książkę
|
|
||||||
teraz dla ciebie pisał będę księżkę
|
|
||||||
będę i on napisał książkę
|
|
||||||
aaa będę śpiewał bbb
|
|
||||||
aaa będę ccc śpiewał bbb
|
|
||||||
aaa będę ccc ddd śpiewał bbb
|
|
||||||
aaa będę ccc ddd eee śpiewał bbb
|
|
||||||
aaa będę ccc ddd eee fff śpiewał bbb
|
|
||||||
pływałem i biegałem
|
|
@ -1,40 +0,0 @@
|
|||||||
Use regular expressions to mark Polish first-person feminine forms.
|
|
||||||
|
|
||||||
You should handle the following types of expressions:
|
|
||||||
|
|
||||||
* first-person feminine past forms of verbs ("zrobiłam", "pisałam", etc.),
|
|
||||||
* first-person singular feminine forms of the verb "być" ("be") combined
|
|
||||||
with singular feminine nominative forms of adjectives ("wysoka", "sprytna", etc.),
|
|
||||||
assuming that the form of the verb "być" is to the left of the adjective, not
|
|
||||||
more than 3 other words,
|
|
||||||
* the verb "będę" combined with the past participle (i.e. 3rd person
|
|
||||||
feminine imperfect form, e.g. "robiła", pisała"), assuming
|
|
||||||
that "będę" is to the left of the adjective, not
|
|
||||||
more than 3 other words to the left of the participle OR directly
|
|
||||||
to the right of the participle ("robiła będę").
|
|
||||||
|
|
||||||
The first-person feminine forms should be marked with curly brackets.
|
|
||||||
You should mark only the feminine form. Do not mark the form of "być"
|
|
||||||
(unless it clearly a feminine form, i.e. for "byłam").
|
|
||||||
|
|
||||||
The match should be case-insensitive.
|
|
||||||
|
|
||||||
The PoliMorf dictionary of inflected forms should be applied:
|
|
||||||
http://zil.ipipan.waw.pl/PoliMorf?action=AttachFile&do=get&target=PoliMorf-0.6.7.tab.gz
|
|
||||||
|
|
||||||
Suggested steps:
|
|
||||||
|
|
||||||
1. Extract all the needed forms from the PoliMorf dictionary:
|
|
||||||
|
|
||||||
* 1st person feminine past forms of verbs, unfortunately
|
|
||||||
this form is not directly present in the lexicon, you need
|
|
||||||
to add "m" to the 3rd person feminine form ("zrobiła" => "zrobiłam")
|
|
||||||
* singular feminine nominative forms of adjectives
|
|
||||||
* feminine past participle (3rd person feminine imperfect forms of verbs)
|
|
||||||
|
|
||||||
You could do this using grep/cut commands — to obtain a simple text files
|
|
||||||
with a word in each line. You can do this once and commit the 3 files to your repository.
|
|
||||||
|
|
||||||
2. In your `run` script/program, read the 3 files and create a large
|
|
||||||
expression with alternatives. Use a regexp library based on DFAs (determintistic
|
|
||||||
finite-automatons).
|
|
@ -1,25 +0,0 @@
|
|||||||
Tu nic nie ma.
|
|
||||||
Wczoraj {ugotowałam} ziemniaki.
|
|
||||||
{Jechałam}, {jechałam} i {jechałam}, a potem się {zatrzymałam}.
|
|
||||||
{Umyłam} się mydłem i bam, złam się.
|
|
||||||
Jestem {wysoka}.
|
|
||||||
Jest {wysoka}.
|
|
||||||
Mówią, że jestem od zawsze niezwykle {sprytna}.
|
|
||||||
aaaa {byłam} aaa {zielona} ddd
|
|
||||||
aaaa {byłam} aaa bbb {zielona} ddd
|
|
||||||
aaaa {byłam} aaa bbb ccc {zielona} ddd
|
|
||||||
aaaa {byłam} aaa bbb ccc ddd zielona ddd
|
|
||||||
aaaa była aaa bbb zielona ddd
|
|
||||||
aaaa byłem aaa bbb zielona ddd
|
|
||||||
aaaa byłem aaa bbb zielony ddd
|
|
||||||
teraz będę {pisała} książkę
|
|
||||||
będę teraz {pisała} książkę
|
|
||||||
będę teraz dla ciebie {pisała} książkę
|
|
||||||
teraz dla ciebie {pisała} będę księżkę
|
|
||||||
będę i ona napisała książkę
|
|
||||||
aaa będę {śpiewała} bbb
|
|
||||||
aaa będę ccc {śpiewała} bbb
|
|
||||||
aaa będę ccc ddd {śpiewała} bbb
|
|
||||||
aaa będę ccc ddd eee {śpiewała} bbb
|
|
||||||
aaa będę ccc ddd eee fff śpiewała bbb
|
|
||||||
{pływałam} i {biegałam}
|
|
@ -1,25 +0,0 @@
|
|||||||
Tu nic nie ma.
|
|
||||||
Wczoraj ugotowałam ziemniaki.
|
|
||||||
Jechałam, jechałam i jechałam, a potem się zatrzymałam.
|
|
||||||
Umyłam się mydłem i bam, złam się.
|
|
||||||
Jestem wysoka.
|
|
||||||
Jest wysoka.
|
|
||||||
Mówią, że jestem od zawsze niezwykle sprytna.
|
|
||||||
aaaa byłam aaa zielona ddd
|
|
||||||
aaaa byłam aaa bbb zielona ddd
|
|
||||||
aaaa byłam aaa bbb ccc zielona ddd
|
|
||||||
aaaa byłam aaa bbb ccc ddd zielona ddd
|
|
||||||
aaaa była aaa bbb zielona ddd
|
|
||||||
aaaa byłem aaa bbb zielona ddd
|
|
||||||
aaaa byłem aaa bbb zielony ddd
|
|
||||||
teraz będę pisała książkę
|
|
||||||
będę teraz pisała książkę
|
|
||||||
będę teraz dla ciebie pisała książkę
|
|
||||||
teraz dla ciebie pisała będę księżkę
|
|
||||||
będę i ona napisała książkę
|
|
||||||
aaa będę śpiewała bbb
|
|
||||||
aaa będę ccc śpiewała bbb
|
|
||||||
aaa będę ccc ddd śpiewała bbb
|
|
||||||
aaa będę ccc ddd eee śpiewała bbb
|
|
||||||
aaa będę ccc ddd eee fff śpiewała bbb
|
|
||||||
pływałam i biegałam
|
|
@ -1,20 +0,0 @@
|
|||||||
Use regular expressions to extract lines containing polish surnames. CASE INSENSITIVE
|
|
||||||
|
|
||||||
Download list of polish male and female surnames from here:
|
|
||||||
|
|
||||||
|
|
||||||
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/35279/table?page=1&per_page=20&q=&sort=
|
|
||||||
* https://dane.gov.pl/pl/dataset/1681,nazwiska-osob-zyjacych-wystepujace-w-rejestrze-pesel/resource/22817/table?page=1&per_page=20&q=&sort=
|
|
||||||
|
|
||||||
|
|
||||||
Extract lines from stdin containing any of the surnames.
|
|
||||||
Look only for surnames no matter casing (case insensitive).
|
|
||||||
The surname does not have to be surrounded by space or any other special characters.
|
|
||||||
Don't search for declined forms of surnames.
|
|
||||||
|
|
||||||
Check either NFA (e.g. re python library) and DFA (google re2) and compare them.
|
|
||||||
|
|
||||||
Submit solution based on a better method.
|
|
||||||
|
|
||||||
NOTE: You could extract the polish surnames list, save it to a file, then commit the file to your repository.
|
|
||||||
NOTE: You may set max_mem to a higher value than the default in re2 library.
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user