aboutsummaryrefslogtreecommitdiff
path: root/challenge-322/ysth/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-322/ysth/python/ch-1.py')
-rw-r--r--challenge-322/ysth/python/ch-1.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-322/ysth/python/ch-1.py b/challenge-322/ysth/python/ch-1.py
new file mode 100644
index 0000000000..739058f480
--- /dev/null
+++ b/challenge-322/ysth/python/ch-1.py
@@ -0,0 +1,18 @@
+import itertools
+import sys
+
+string = sys.argv[1]
+group_size = int(sys.argv[2])
+
+print(
+ "-".join(
+ reversed(
+ [
+ "".join(reversed(group))
+ for group in itertools.batched(
+ reversed(string.replace("-", "")), group_size
+ )
+ ]
+ )
+ )
+)