From 90db18cf5e9fb4be2e9e69aa3e6318ee681c74dc Mon Sep 17 00:00:00 2001 From: Eryk Miszczuk Date: Tue, 5 Nov 2019 11:59:16 +0100 Subject: [PATCH] Task A47 --- TaskA37/run | 2 +- TaskA47/run | 2 ++ TaskA47/run.py | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 TaskA47/run create mode 100644 TaskA47/run.py diff --git a/TaskA37/run b/TaskA37/run index afa66c0..273ba7a 100644 --- a/TaskA37/run +++ b/TaskA37/run @@ -1,2 +1,2 @@ #!/bin/bash -python TaskA29/run.py "$@" +python TaskA37/run.py "$@" diff --git a/TaskA47/run b/TaskA47/run new file mode 100644 index 0000000..a181a53 --- /dev/null +++ b/TaskA47/run @@ -0,0 +1,2 @@ +#!/bin/bash +python TaskA47/run.py "$@" diff --git a/TaskA47/run.py b/TaskA47/run.py new file mode 100644 index 0000000..339c04e --- /dev/null +++ b/TaskA47/run.py @@ -0,0 +1,17 @@ +import sys +import re + +regex = re.compile('(#[A-Za-z][A-Za-z0-9]*)') + +for line in sys.stdin: + hashtags = list(regex.findall(line.replace('\n', ''))) + if hashtags: + answer = '' + for i, tag in enumerate(hashtags): + if i == 0: + answer += tag + else: + answer += ';' + tag + print(answer) + else: + print('')