yeon
yeon I am a Korean web programmer with bboy dancing as a hobby. :)

No Idea!

No Idea!

hacker rank


Python Practice


No Idea!


Input Format


The first line contains integers n and m separated by a space.
The second line contains n integers, the elements of the array.
The third and fourth lines contain m integers, A and B, respectively.


Output Format


Output a single integer, your total happiness.


Sample Input

1
2
3
4
3 2
1 5 3
3 1
5 7


Sample Output

1
1



My code


1
2
3
4
5
6
7
8
n, m = raw_input().split()
arr = map(int, raw_input().split())
a = set(map(int, raw_input().split()))
b = set(map(int, raw_input().split()))

count = [1 if x in a else -1 if x in b else 0 for x in arr]

print(sum(count))



Hacker Rank > Python > set > No Idea!

comments powered by Disqus