Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Code Written by : John Nixon
- #Date: 06:08:2022 Time: 12:08:33
- #Copyrights are applicable
- import sys
- import os
- sys.setrecursionlimit(10000)
- try:
- sys.stdin = open('./input.txt', 'r')
- sys.stdout = open('./output.txt', 'w')
- except:
- pass
- 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