Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output = []
- lst1 = input().split(',')
- lst2 = input().split(',')
- for i in range(len(lst1)):
- lst1[i] = int(lst1[i])
- for i in range(len(lst2)):
- lst2[i] = int(lst2[i])
- for i in range(len(lst1)):
- if lst1[i] in lst2:
- x = lst2.index(lst1[i])
- if x == len(lst2) - 1:
- output.append(-1)
- else:
- if lst2[x+1] > lst1[i]:
- output.append(lst2[x+1])
- else: output.append(-1)
- print(*output, sep = ',')
Advertisement
Add Comment
Please, Sign In to add comment