Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_digits(stri):
- out = "0"
- for number in range(len(stri)):
- if stri[:number + 1].isdigit():
- out = stri[:number + 1]
- continue
- break
- return int(out)
- def split_by_digit(stri: str):
- lis = []
- index = 0
- while len(stri) != index:
- if stri[index].isdigit():
- multiplyer = get_digits(stri[index:])
- lis.append((stri[:index], multiplyer))
- stri = stri[index + len(str(multiplyer)):]
- index = 0
- continue
- index += 1
- return lis
- def dict_to_string(dictionary: list):
- return "". join([key[0] * key[1] for key in dictionary])
- string = input()
- out = dict_to_string(split_by_digit(string)).upper()
- print(f"Unique symbols used: {len(set(out))}")
- print(out.replace("\\N","\n"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement