bounslay

Untitled

May 15th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. first_lst = [int(i) for i in input().split(',')]
  2. second_lst = [int(i) for i in input().split(',')]
  3.  
  4. new_set = len(first_lst) * [-1]
  5.  
  6. for i in range(len(first_lst)):
  7.     for j in range(len(second_lst)):
  8.  
  9.         if first_lst[i] == second_lst[j]:
  10.  
  11.             for k in range(j+1, len(second_lst)):
  12.                 if second_lst[k] > first_lst[i]:
  13.                     new_set[i] = second_lst[k]
  14.                     break
  15.  
  16.  
  17. print(','.join(str(i) for i in new_set))
Advertisement
Add Comment
Please, Sign In to add comment