Problem:
Hit and Blow Let's play Hit and Blow game. A imagines four numbers and B guesses the numbers. After B picks out four numbers, A answers:  The number of numbers which have the same place with numbers A imagined (Hit)  The number of numbers included (but different place) in the numbers A imagined (Blow)  For example, if A imagined numbers: 9 1 8 2 and B chose: 4 1 5 9  A should say 1 Hit and 1 Blow. Write a program which reads four numbers A imagined and four numbers B chose and prints the number of Hit and Blow respectively. You may assume that the four numbers are all different and within from 0 to 9. Input The input consists of multiple datasets. Each dataset set consists of:  a 1  a 2  a 3  a 4  b 1  b 2  b 3  b 4  , where a i (0 ≤ a i ≤ 9) is i -th number A imagined and b i (0 ≤ b i ≤ 9) is i -th number B chose. The input ends with EOF. The number of datasets is less than or equal to 50. Output For each dataset, print the number of Hit and Blow in a line. These two numbers should be separated by a space. Sample Input 9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2 Output for the Sample Input 1 1
3 0

Solution (Python):
while True:
  try:
    a_set = list(map(int, input().split()))
    b_set = list(map(int, input().split()))
  except EOFError:
    break
  hit = 0
  blow = 0
  for i in range(4):
    if a_set[i] == b_set[i]:
      hit += 1
  for i in range(4):
    for j in range(4):
      if a_set[i] == b_set[j] and i != j:
        blow += 1
  print(hit,blow)

Solution (Python):
import sys

alist = []
blist = []
cnt = 0

for line in sys.stdin:
	if cnt%2 == 0: alist.append(map(int, line.split()))
	else: blist.append(map(int, line.split()))
	cnt += 1

for i in range(0, len(alist)):
	a = alist[i]
	b = blist[i]
	hitcount = 0
	blowcount = 0
	for j in range(0, 4):
		if a[j] == b[j]: hitcount += 1
	for j in range(0, 4):
		for k in range(0, 4):
			if a[j] == b[k] and j != k: blowcount += 1
	print str(hitcount)+' '+str(blowcount)

Solution (Python):
import sys
  
lines = sys.stdin.readlines()
n = len(lines)//2

for i in range(n):
    hit = 0
    blow = 0
    cache = {}
    a = list(map(int, lines[i*2].split()))
    b = list(map(int, lines[i*2+1].split()))
    for j in range(len(a)):
        if a[j] == b[j]:
            hit += 1
        else:
            cache[a[j]] = True
    for j in range(len(b)):
        if cache.get(b[j]):
            blow += 1
    print(hit,blow)

Solution (Python):
def judge_hit(num1, num2):
    cnt = 0
    for a, b in zip(num1, num2):
        if a == b:
            cnt += 1
    return cnt

def judge_blow(num1, num2, hit):
    cnt = 0
    for b in num2:
        cnt += (b in num1)
    return cnt - hit

while True:
    try:
        A_number = map(int, raw_input().split())
        B_number = map(int, raw_input().split())
        hit = judge_hit(A_number, B_number)
        blow = judge_blow(A_number, B_number, hit)
        print hit, blow 
    except:
        break

Solution (Python):
while(1):
    try:
        alist = list(map(int, input().split()))
        blist = list(map(int, input().split()))
    except:
        break
 
    hit = 0
    blow = 0
 
    for i in range(4):
        for j in range(4):
            if alist[i] == blist[j]:
                if i == j:
                    hit += 1
                else:
                    blow += 1
 
    print(hit, blow)

Solution (Python):
while(1):
	try:
		a = [int(i) for i in input().split()]
		b = [int(i) for i in input().split()]
		hit = 0
		for i,j in zip(a,b):
			if i == j:
				hit += 1
		sa = set(a)
		sb = set(b)
		u = sa & sb
		blow = len(u) - hit
		print(hit, blow)
	except EOFError:
		break

Solution (Python):
while True:
    try:
        a = [x for x in input().split()]
        b = [x for x in input().split()]
        hit_count = 0
        blow_count = 0
        for i in range(4):
            if a[i] == b[i]:
                hit_count += 1
            elif(b[i] in a):
                blow_count += 1
        print(hit_count, blow_count)
    except EOFError:
        break

Solution (Python):
while(1):
    try:
        alist = list(map(int, input().split()))
        blist = list(map(int, input().split()))
    except:
        break

    hit = 0
    blow = 0

    for i in range(4):
        for j in range(4):
            if alist[i] == blist[j]:
                if i == j:
                    hit += 1
                else:
                    blow += 1

    print(hit, blow)

Solution (Python):
def process(A, B):
    hit, blow = 0, 0
    for a, b in zip(A, B):
        if a == b:
            hit += 1
        elif a in B:
            blow += 1
    return (hit, blow)

while True:
    try:
        A = input().split()
        B = input().split()
    except: break
    hit, blow = process(A, B)
    print(hit, blow)

Solution (Python):
import sys
lines = []
for index, line in enumerate(sys.stdin):
  line = line.strip()
  if index%2 == 0:
    lines.append( [line] )
  else:
    lines[-1].append( line )

lines = iter(lines)
for line in lines:
  i1 = line
  xs = list(map(int, i1[0].split() ))
  ys = list(map(int, i1[1].split() ))
  full_match = 0
  spec_match = 0
  for x, y in zip(list(xs), list(ys)):
    
    if x == y:
      full_match += 1
    elif y in xs:
      spec_match += 1
  print(full_match, spec_match)

Solution (Python):
while(True):
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        h = [c-d for c,d in zip(a,b)].count(0)
        v = sum([a.count(d) for d in b]) - h
        print(h,v)
    except:
        break

Solution (Python):
import sys

def solve():
    A = []
    B = []
    for i, line in enumerate(sys.stdin):
        t = tuple(map(int, line.split()))
        if i % 2 == 0:
            A.append(t)
        else:
            B.append(t)
    
    for a, b in zip(A, B):
        hit, blow = 0, 0
        
        for i, bb in enumerate(b):
            for j, aa in enumerate(a):
                if bb == aa and i == j:
                    hit += 1
                    break
                elif bb == aa and i != j:
                    blow += 1
                    break
        print(hit, blow)
        

if __name__ == "__main__":
    solve()

Solution (Python):
hoge = 0
while True:
	try:
		hit = 0
		blow = 0
		a = map(int, raw_input().split())
		b = map(int, raw_input().split())
		for i in range(4):
			try:
				if a.index(b[i]) == i:
					hit += 1
				else:
					blow += 1
			except ValueError:
				continue
		print hit, blow
	except EOFError:
		break