Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n,m = [int(x) for x in input().split()]
- a = []
- b = []
- colors = {}
- for i in range(n):
- x = int(input())
- if(x not in colors):
- colors[x] = 1
- else:
- colors[x] = 2
- a.append(int(x))
- for i in range(m):
- x = int(input())
- if(x not in colors):
- colors[x] = 1
- else:
- colors[x] = 2
- b.append(int(x))
- counter = 0
- for i in colors:
- if(colors[i] == 2):
- counter += 1
- print(counter)
- for i in colors:
- if(colors[i] == 2):
- print(i, end = " ")
- print()
- a.sort()
- print(n - counter)
- for i in range(n):
- if (colors[a[i]] == 1):
- print(a[i], end = " ")
- print()
- b.sort()
- print(m - counter)
- for i in range(m):
- if colors[b[i]] == 1:
- print(b[i], end = " ")
Advertisement
Add Comment
Please, Sign In to add comment