Advertisement
horozov86

Rage Quit

Mar 20th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. text = input().upper()
  2.  
  3. unique_symbols = ""
  4. current_symbol = ""
  5. repetitions = ""
  6.  
  7. for i in range(len(text)):
  8.     if not text[i].isdigit():
  9.         current_symbol += text[i]
  10.  
  11.     else:
  12.         for idx in range(i, len(text)):
  13.             if not text[idx].isdigit():
  14.                 break
  15.             repetitions += text[idx]
  16.         repetitions = int(repetitions)
  17.         unique_symbols += repetitions * current_symbol
  18.         current_symbol = ""
  19.         repetitions = ""
  20.  
  21. print(f"Unique symbols used: {len(set(unique_symbols))}")
  22. print(unique_symbols)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement