PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#challenge: https://www.sololearn.com/Discuss/769959/
#proposed bt noobcoder
#made by ysraelcon
#instructions: Input a text and the process to do
"""
#Example, input: aaabbc:encode
#Example2, input: 3a2b1c:decode
"""
import re
ms=input("From text entered: ").split(":")
print(ms[0])
s=ms[0]; t=ms[1]
t=t if t!="" else "encode"
if t=="encode":
v=re.findall(r'((.)\2*)',s)
vi=[x for x,y in v]
vl=list(map(lambda x: str(len(x))+x[0],vi ) )
rl="".join(vl)
print("result "+t+": "+rl)
else:
ld=list(s); ns=""
for i,v in enumerate(s):
if i%2==0: ns+=int(v)*s[i+1]
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run