From 4afd894364f5a2bdd8cf1ffcde1d9253d3119bd1 Mon Sep 17 00:00:00 2001 From: luminoksik Date: Thu, 9 Jan 2025 11:17:20 +0100 Subject: [PATCH] task c47 done --- TaskC47/task47.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 TaskC47/task47.py diff --git a/TaskC47/task47.py b/TaskC47/task47.py new file mode 100644 index 0000000..7112e85 --- /dev/null +++ b/TaskC47/task47.py @@ -0,0 +1,25 @@ +import re + +pattern = re.compile(r'#[a-zA-Z]\w*') + +def check(given_text): + result = re.findall(pattern, given_text) + if result: + return ';'.join(result) + else: + return '' + +### test + +# with open('test.in', 'r', encoding='utf-8') as f: +# lines = f.readlines() +# for line in lines: +# line = line.strip() +# print(check(line)) + +while True: + text = input('Please provide your text: ') + if text == 'END': + break + print(check(text)) + print('To end type END') \ No newline at end of file