# ---------------------------------- # 3. Expand String # Input : a4b3c5 # Output: aaaabbbccccc # ----------------------------------
Anonymous
s = "a4b3c5" result = "" for i in range(0, len(s), 2): result += s[i] * int(s[i+1]) print(result)
Check out your Company Bowl for anonymous work chats.