Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- numbers = input().split(' ')
- text = [m for m in input() if m.isalpha() or m.isspace()]
- new_word = ''
- curr_sum = 0
- indexes = []
- for element in numbers:
- for digit in element:
- curr_sum += int(digit)
- indexes.append(curr_sum)
- curr_sum = 0
- for index in indexes:
- if index > len(text):
- index = index - len(text)
- new_word += text[index]
- else:
- new_word += text[index]
- text.pop(index)
- print(new_word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement