Created
January 29, 2023 19:23
-
-
Save maestroviktorin/205baed895294fadb8297675dcae6e33 to your computer and use it in GitHub Desktop.
Solution to the problem #4322 by /dev/inf from kompege.ru
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Solution to the problem No. 4322 by /dev/inf from kompege.ru | |
| `10.txt` is a text file in which the beginning and each line of type `Глава \d+` | |
| must be deleted manually in the Notebook for example. | |
| """ | |
| import re | |
| with open('10.txt') as file: | |
| rows = (tuple(re.sub(r'\W', '', word).lower() | |
| for word in row.split()) for row in file) | |
| c = 0 | |
| for row in rows: | |
| for word in row: | |
| c += ('в' in word) and all(char not in word for char in ('а', 'о')) | |
| print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment