Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- def int_cast(integers):
- if not integers:
- return 0
- else:
- value = int(integers)
- return value
- def get_string(input_str):
- regex = r"([A-z]+)([0-9]+)"
- matches = re.findall(regex, input_str, re.MULTILINE)
- letter_string = ""
- for match in matches:
- letters, integers = match
- letter_string += int_cast(integers)*letters
- return letter_string
- if __name__=="__main__":
- input_str = "Z3f4g7d10a6c0"
- print(get_string(input_str))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement