Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dnk = str(input())
- new_dnk = ''
- algo = []
- old_dnk = ''
- for i in dnk:
- if dnk.count(i) >= 2 and i not in new_dnk:
- new_dnk += i + str(dnk.count(i))
- algo.append(i)
- algo.append(str(dnk.count(i)))
- elif i not in new_dnk:
- new_dnk += i
- algo.append(i)
- print(new_dnk)
- for i in range(len(algo)):
- d = i + 1
- try:
- old_dnk += algo[i] * int(algo[d])
- i += 1
- except:
- if algo[i].isdigit() == True:
- pass
- else:
- old_dnk += algo[i]
- print(old_dnk)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement