From 5f3145b34d659f622685a3b41e3578e849044326 Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 15:36:12 +0300 Subject: [PATCH 1/6] Adding various punctuation marks, according to description --- tasks/easy/strings/more_than_medium.toml | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index 118462c..b5a1e1e 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -4,15 +4,15 @@ tags = ["strings"] time_to_solve_sec = 350 description_en = """ -Given a sentence (as string), return an array of words which are longer than the average length of all the words. +The sentence is given (as a string). Return a list of words that are longer than the average length of all words. If there are no such words, return `["there is no result!"]`. -Words are separated by a whitespace. If there is a trailing period (dot), it should be omitted. If there is no result, return `["there is no result!"]`. +Words are separated by a whitespace. If there are any punctuation marks, they should be omitted. """ description_ru = """ -Дано предложение (строкой), верните массив слов, длина которых превышает среднюю длину всех слов. +Дано предложение (строкой). Верните список слов, длина которых превышает среднюю длину всех слов. Если таких нет, верните `["there is no result!"]`. -Слова разделены пробелом. Если присутствует точка, её следует пропустить. Если результата нет, верните `["there is no result!"]`. +Слова разделены пробелом. Если присутствуют знаки препинания, их не следует учитывать. """ limits = """ @@ -34,7 +34,7 @@ def solution(sentence: str) -> list: examples = """ solution("test") == ["there is no result!"] -solution("This is a sample string") == ["This", "sample", "string"] +solution("This is a sample string.") == ["This", "sample", "string"] solution("Some another sample") == ["another", "sample"] """ @@ -54,8 +54,8 @@ comment = "Single word" expected = ["there is no result!"] [[asserts]] -arguments = ["This is a sample string"] -comment = "Multiple words, some longer" +arguments = ["This is a sample string."] +comment = "Multiple words, some longer, the period at the end" expected = ["This", "sample", "string"] [[asserts]] @@ -84,8 +84,8 @@ comment = "Single word short" expected = ["there is no result!"] [[asserts]] -arguments = ["one two three four five"] -comment = "Five words" +arguments = ["one, two, three, four, five"] +comment = "Five comma-separated words" expected = ["three", "four", "five"] [[asserts]] @@ -104,9 +104,9 @@ comment = "Four words" expected = ["python"] [[asserts]] -arguments = ["test case for this task"] -comment = "Five words equal length" -expected = ["test", "case", "this", "task"] +arguments = ["Some test case for this task..."] +comment = "Six words of approximately equal length, the ellipsis at the end" +expected = ["Some", "test", "case", "this", "task"] [[asserts]] arguments = ["a ab abc abcd"] @@ -129,8 +129,8 @@ comment = "Three words" expected = ["testing", "quality"] [[asserts]] -arguments = ["The cat sat on mat"] -comment = "Five words" +arguments = ["The cat sat on mat!"] +comment = "Five words, the exclamation mark at the end" expected = ["The", "cat", "sat", "mat"] [[asserts]] @@ -139,8 +139,8 @@ comment = "Three words technical" expected = ["algorithm", "patterns"] [[asserts]] -arguments = ["a b c d e f g"] -comment = "Seven single letters" +arguments = ["a, b, c, d, e, f, g"] +comment = "Seven comma-separated single letters" expected = ["there is no result!"] [[asserts]] @@ -155,7 +155,7 @@ expected = ["longerword"] [[asserts]] arguments = ["same same same same"] -comment = "All same word" +comment = "All 'same' word" expected = ["there is no result!"] [[asserts]] From bbfc428cb7a1641ad5c550917f61020c3f6193b0 Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 15:50:16 +0300 Subject: [PATCH 2/6] Removing tests with the same idea as another test --- tasks/easy/strings/more_than_medium.toml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index b5a1e1e..bc3c48d 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -33,7 +33,7 @@ def solution(sentence: str) -> list: """ examples = """ -solution("test") == ["there is no result!"] +solution("hello") == ["there is no result!"] solution("This is a sample string.") == ["This", "sample", "string"] solution("Some another sample") == ["another", "sample"] """ @@ -48,11 +48,6 @@ name = "array" [output_signature.type.nested] name = "string" -[[asserts]] -arguments = ["test"] -comment = "Single word" -expected = ["there is no result!"] - [[asserts]] arguments = ["This is a sample string."] comment = "Multiple words, some longer, the period at the end" @@ -78,11 +73,6 @@ arguments = ["a bb ccc dddd"] comment = "Increasing lengths" expected = ["ccc", "dddd"] -[[asserts]] -arguments = ["short"] -comment = "Single word short" -expected = ["there is no result!"] - [[asserts]] arguments = ["one, two, three, four, five"] comment = "Five comma-separated words" @@ -118,11 +108,6 @@ arguments = ["short longer longest"] comment = "Three words increasing" expected = ["longest"] -[[asserts]] -arguments = ["one"] -comment = "Single word one" -expected = ["there is no result!"] - [[asserts]] arguments = ["testing code quality"] comment = "Three words" From 2254112f456733d5cb3a3251df949ef70b24f58c Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 15:56:22 +0300 Subject: [PATCH 3/6] Removing test with the same idea as another test --- tasks/easy/strings/more_than_medium.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index bc3c48d..21cdee7 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -98,11 +98,6 @@ arguments = ["Some test case for this task..."] comment = "Six words of approximately equal length, the ellipsis at the end" expected = ["Some", "test", "case", "this", "task"] -[[asserts]] -arguments = ["a ab abc abcd"] -comment = "Increasing a sequence" -expected = ["abc", "abcd"] - [[asserts]] arguments = ["short longer longest"] comment = "Three words increasing" From de3b1d89ddec2e5deb9e5ff644022b044e05b5d0 Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 16:00:09 +0300 Subject: [PATCH 4/6] Removing test with the same idea as another test --- tasks/easy/strings/more_than_medium.toml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index 21cdee7..eafa61c 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -84,8 +84,8 @@ comment = "Five words with the" expected = ["quick", "brown", "jumps"] [[asserts]] -arguments = ["aa bb cc dd ee"] -comment = "All equal length" +arguments = ["aa bb cc DD EE"] +comment = "Five two-letter words" expected = ["there is no result!"] [[asserts]] @@ -148,11 +148,6 @@ arguments = ["functional programming paradigm"] comment = "Three long words" expected = ["functional", "programming"] -[[asserts]] -arguments = ["ab cd ef gh ij"] -comment = "Five two letter words" -expected = ["there is no result!"] - [[asserts]] arguments = ["machine learning artificial intelligence"] comment = "Four words AI" From ff9b52c223ce2dd86215913a1517de2ddacb92e7 Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 16:24:46 +0300 Subject: [PATCH 5/6] Fix raw-string reg-ex in solution --- tasks/easy/strings/more_than_medium.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index eafa61c..36882ee 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -22,7 +22,7 @@ limits = """ solution = """ def solution(sentence: str) -> list: import re - words = re.findall(r'\\w+', sentence) + words = re.findall(r'\w+', sentence) if not words: return ["there is no result!"] From 115af55fdb9b8f573256ca06808465a3a0797404 Mon Sep 17 00:00:00 2001 From: Dmitrii Ushakov Date: Mon, 23 Mar 2026 18:13:33 +0300 Subject: [PATCH 6/6] Adding hyphens as significant punctuation marks --- tasks/easy/strings/more_than_medium.toml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tasks/easy/strings/more_than_medium.toml b/tasks/easy/strings/more_than_medium.toml index 36882ee..749cece 100644 --- a/tasks/easy/strings/more_than_medium.toml +++ b/tasks/easy/strings/more_than_medium.toml @@ -6,13 +6,13 @@ time_to_solve_sec = 350 description_en = """ The sentence is given (as a string). Return a list of words that are longer than the average length of all words. If there are no such words, return `["there is no result!"]`. -Words are separated by a whitespace. If there are any punctuation marks, they should be omitted. +Words are separated by a whitespace. If there are any punctuation marks, they should be omitted (except hyphens). """ description_ru = """ Дано предложение (строкой). Верните список слов, длина которых превышает среднюю длину всех слов. Если таких нет, верните `["there is no result!"]`. -Слова разделены пробелом. Если присутствуют знаки препинания, их не следует учитывать. +Слова разделены пробелом. Если присутствуют знаки препинания, их не следует учитывать (кроме дефисов). """ limits = """ @@ -22,7 +22,7 @@ limits = """ solution = """ def solution(sentence: str) -> list: import re - words = re.findall(r'\w+', sentence) + words = re.findall(r'[\w-]+', sentence) if not words: return ["there is no result!"] @@ -167,3 +167,13 @@ expected = ["development", "environment"] arguments = ["equal equal equal"] comment = "Three equal words" expected = ["there is no result!"] + +[[asserts]] +arguments = ["This is a well-known fact"] +comment = "A hyphen inside one of the words" +expected = ["well-known"] + +[[asserts]] +arguments = ["red-painted T-shirt"] +comment = "A hyphen inside both words" +expected = ["red-painted"]