Advertisement
bAngelov

Rage Quit

Jul 15th, 2022
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. def get_digits(stri):
  2.     out = "0"
  3.     for number in range(len(stri)):
  4.         if stri[:number + 1].isdigit():
  5.             out = stri[:number + 1]
  6.             continue
  7.         break
  8.     return int(out)
  9.  
  10. def split_by_digit(stri: str):
  11.     lis = []
  12.     index = 0
  13.     while len(stri) != index:
  14.         if stri[index].isdigit():
  15.             multiplyer = get_digits(stri[index:])
  16.             lis.append((stri[:index], multiplyer))
  17.             stri = stri[index + len(str(multiplyer)):]
  18.             index = 0
  19.             continue
  20.         index += 1
  21.     return lis
  22.  
  23. def dict_to_string(dictionary: list):
  24.     return "". join([key[0] * key[1] for key in dictionary])
  25.  
  26.  
  27. string = input()
  28. out = dict_to_string(split_by_digit(string)).upper()
  29. print(f"Unique symbols used: {len(set(out))}")
  30. print(out.replace("\\N","\n"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement