Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- first_seq = input().split()
- sec_seq = input().split()
- instructions = input().split(', ')
- for instruction in instructions:
- start, end = map(int, instruction.split())
- if start < end:
- first_seq[start:end+1], sec_seq[start:end+1] = sec_seq[start:end+1], first_seq[start:end+1]
- else:
- first_seq[end:start+1], sec_seq[end:start+1] = sec_seq[end:start+1], first_seq[end:start+1]
- print(' '.join(first_seq))
- print(' '.join(sec_seq))
Advertisement
Add Comment
Please, Sign In to add comment