Advertisement
snow27

Rage Quit

Nov 19th, 2020
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. line = input().upper()
  2. index = 0
  3. new_line = ""
  4. while index < len(line):
  5.     piece = ""
  6.     len_num = ""
  7.     num = 0
  8.     while not line[index].isdigit():
  9.         piece += line[index]
  10.         index += 1
  11.     while line[index].isdigit():
  12.         len_num += line[index]
  13.         index += 1
  14.         if index == len(line):
  15.             break
  16.     num = int(len_num)
  17.     new_line += piece * num
  18. unique = len(''.join(set(new_line)))
  19. print(f"Unique symbols used: {unique}")
  20. print(new_line)
  21.  
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement