Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- socks = list(map(str,input().split()))
- # print(socks)
- freq = {}
- unPaired = []
- for sock in socks:
- if sock in freq:
- if sock in unPaired:
- unPaired.remove(sock)
- del freq[sock]
- else:
- freq[sock] = 1
- unPaired.append(sock)
- if len(unPaired) > 0:
- for sock in unPaired:
- print("1 "+sock,end=" ")
- print("is not having any pair")
- else:
- print("it is paired")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement