You are viewing a single comment's thread. Return to all comments →
import re import sys def count_occurrences(text: str) -> str: _, search_text, test_cases_text = re.split(r"\d\n", text) test_cases = test_cases_text.split() occurrences: list[int] = [ len(re.findall(rf"{test_case[:-2]}[sz]e", search_text)) for test_case in test_cases ] return "\n".join(map(str, occurrences)) print(count_occurrences(sys.stdin.read()), file=sys.stdout)
Seems like cookies are disabled on this browser, please enable them to open this website
The British and American Style of Spelling
You are viewing a single comment's thread. Return to all comments →