Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. numbers = list(map(int, input().split()))
  2. input_string = input()
  3.  
  4. indices = []
  5.  
  6. for number in numbers:
  7.     number_in_list = [int(x) for x in str(number)]
  8.     indices.append(sum(number_in_list))
  9.  
  10. word = ""
  11.  
  12. for index in indices:
  13.     if index > len(input_string) - 1:
  14.         index -= len(input_string)
  15.  
  16.     word += input_string[index]
  17.     input_string = input_string[0:index] + input_string[index + 1:len(input_string) + 1]
  18.  
  19. print(word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement