from collections import defaultdict graph=defaultdict(list) v,e=map(int,input().split()) for i in range(e): u,v=map(str,input().split()) graph[u].append(v) graph[v].append(u) for i in graph: print(i,"->",graph[i]) Input: 7 9 A B A C A F C E C F C D D E D G G F Output: F -> ['A', 'C', 'G'] C -> ['A', 'E', 'F', 'D'] G -> ['D', 'F'] D -> ['C', 'E', 'G'] A -> ['B', 'C', 'F'] E -> ['C', 'D'] B -> ['A']
"""
n=[23, 2, 2, 24, 7, 23, 5, 24, 5]
printing
res n[i] res^n[i]
23 2 21
21 2 23
23 24 15
15 7 8
8 23 31
31 5 26
26 24 2
2 5 7
so the res = 7
we know that n^n=0
where n^0 = n
this is how the repeated elements are vanised
"""
def find(n):
res=n[0]
for i in range(1,len(n)):
res=res^ n[i]
return res
n=list(map(int,input().split()))
s=find(n)
print(s)
Comments
Post a Comment