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 = map(int, raw_input().split())
        b = map(int, raw_input().split())
        hit = blow = 0
        for i in range(4):
            if a[i] == b [i]:
                hit+=1
            elif a[i] in b:
                blow+=1
        print hit, blow
    except:
        break

Solution (Python):
while True:
    try:
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
        hit,blow=0,0
        ac=0
        for i in a:
            bc=0
            ac +=1
            for j in b:
                bc +=1
                if i==j:
                    if ac==bc:
                        hit +=1
                    else:
                        blow +=1
        print(hit,blow)
    except:break

Solution (Python):


while True:
    try:
        A, B = input().split(), input().split()
        hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
        blow = sum([ 1 for i in range(len(A)) if B[i] in A ]) - hit
        print(str(hit) + ' ' +str(blow))
    except:
        break

Solution (Python):


while True:
    try:
        A, B = input().split(), input().split()
        hit = sum([ 1 for i in range(len(A)) if A[i]==B[i] ])
        blow = sum([ 1 for i in range(len(A)) if B[i] in A ]) - hit
        print(str(hit) + ' ' +str(blow))
    except:
        break

Solution (Python):

while True:
  try:
    a_list = map(int, raw_input().strip().split(" "));
    b_list = map(int, raw_input().strip().split(" "));
  except:
    break;
  hit, blow = 0, 0
  for a, b in zip(a_list, b_list):
    if (a == b):
      hit += 1;
    elif(a in b_list):
      blow += 1;
  print hit, blow

Solution (Python):
while True:
  try:
    a = map(int, raw_input().split())
    b = map(int, raw_input().split())
  except:
    break
  ab = zip(a, b)
  hit = 0
  blow = 0
  for xa, xb in ab:
    if xa == xb:
      hit  += 1
    elif xa in b:
      blow += 1
  print('%d %d' % (hit, blow))

Solution (Python):



import sys
import math

tf = True
for s in sys.stdin:
  if tf:
    a = map(int,s.split())
    tf = False
    continue
  else:
    b = map(int,s.split())
    tf = True
  print sum([ 1 for i in range(4) if a[i]==b[i] ]),
  print sum([ 1 for i in range(4) for j in range(4) if i != j and a[i] == b[j] ])

Solution (Python):
import sys
lines = [list(map(int, line.split())) for line in sys.stdin]
for i in range(0, len(lines), 2):
    a = lines[i]
    b = lines[i + 1]
    hit = sum(1 for i in range(len(a)) if a[i] == b[i])
    blow = sum(1 for bi in b if bi in a) - hit
    print(hit, blow)

Solution (Python):

def Hit(an_list,bn_list):
    n = 0
    for a in enumerate(an_list):
        for b in enumerate(bn_list):
            if a == b:
                n +=1
    return n

def Blow(an_list,bn_list):
    n = 0
    for an in an_list:
        for bn in bn_list:
            if an == bn:
                n +=1
    return n

while True:
    try:
        [a1,a2,a3,a4] = map(int,raw_input().split())
        [b1,b2,b3,b4] = map(int,raw_input().split())
    except EOFError:
        break
    
    an_list = [a1,a2,a3,a4]
    bn_list = [b1,b2,b3,b4]
    hit = Hit(an_list,bn_list)
    blow = Blow(an_list,bn_list)
    
    print "%d %d" % (hit,blow-hit)

Solution (Python):






while True:
    try:
        a=list(map(int, input().split()))
        b=list(map(int, input().split()))
    except:
        break;

    hit=0
    blow=0
    for i in range(4):
        if a[i] == b[i]: 
            hit += 1
    for i in range(4):
        for j in range(4):
            if i != j and a[i] == b[j]: blow += 1

    print(str(hit) + " " + str(blow))

Solution (Python):
while True:
    try:
        L1=map(int,raw_input().split())
        L2=map(int,raw_input().split())
        hit,blow=0,0
        for i in range(4):
            blow+=L1.count(L2[i])
            if L1[i]==L2[i]:
                blow-=1
                hit+=1
        print hit,blow

    except:
        break

Solution (Python):
def check():
    count1 = 0
    for i in range(4):
        if A[i] == B[i]:
            count1 += 1
    count2 = 0
    for v in B:
        if v in A:
            count2 += 1
    Hit = count1
    Blow = count2 - count1
    
    print Hit, Blow
    
while True:
    try:
        A = list(raw_input().split())
        B = list(raw_input().split())
        check()
    except EOFError:
        break

Solution (Python):
import sys

def hitBlow(a, b):
    hit = 0
    blow = 0
    for i in range(len(a)):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(len(b)):
                if a[i] == b[j]:
                    blow += 1

    return [hit, blow]

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = list(map(int, input().split()))

    hit, blow = hitBlow(a, b)

    print(hit, blow)

Solution (Python):


def main():
    while True:
        try:
            A=input().split()
            B=input().split()

            Hit=0
            Blow=0

            for b in B:
                if b in A:
                    index=B.index(b)
                    if b==A[index]:
                        Hit+=1

                    else:
                        Blow+=1
            print(Hit,Blow)

        except:
            break
            
    
        
if __name__ == '__main__':
    main()

Solution (Python):
while True:
	try:
		s1 = raw_input()
		s2 = raw_input()
		a = map(int, s1.split())
		b = map(int, s2.split())
		hashMap = {}
		hit = 0
		blow = 0
		for i in range(len(a)):
			hashMap[a[i]] = i
		for i in range(len(b)):
			if b[i] in hashMap:
				if hashMap[b[i]] == i:
					hit += 1
				else:
					blow += 1
		print '%s %s' % (hit, blow)
	except (EOFError):
		break

Solution (Python):
from math import *
PI = 3.1415926535898
while True:
	try:
		a = map(int, raw_input().strip().split(' '))
		b = map(int, raw_input().strip().split(' '))
		hit = 0
		blow = 0
		for i in range(len(a)):
			if a[i] == b[i]:
				hit += 1
			elif b.count(a[i]) > 0:
				blow += 1
		print "%d %d" % (hit, blow)
	except EOFError:
		break

Solution (Python):

import sys
def hit_blow(num):
   hits = 0
   blows = 0
   emp1 = [0,0,0,0]
   emp2 = [0,0,0,0]
   num.append(emp1)
   num.append(emp2)
   for i in range(0,4):
       i = i*2
       for j in range(0,4):
           j = j*2
           if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
               if i ==j :
                   hits += 1
               else:
                   blows += 1
               num[2][int(i/2)] = 1
               num[3][int(j/2)] = 1
   print(hits,blows)

flag = 0
num = []
for line in sys.stdin.readlines():
   if flag == 0:
       num.append(line)
       flag = 1
   elif flag == 1:
       num.append(line)
       flag = 2
   if flag == 2:
       flag = 0
       hit_blow(num)
       del num[:]

Solution (Python):

import sys
def hit_blow(num):
   hits = 0
   blows = 0
   emp1 = [0,0,0,0]
   emp2 = [0,0,0,0]
   num.append(emp1)
   num.append(emp2)
   for i in range(0,4):
       i = i*2
       for j in range(0,4):
           j = j*2
           if num[0][i] == num[1][j] and num[2][int(i/2)] == 0 and num[3][int(j/2)] == 0:
               if i ==j :
                   hits += 1
               else:
                   blows += 1
               num[2][int(i/2)] = 1
               num[3][int(j/2)] = 1
   print(hits,blows)

flag = 0
num = []
for line in sys.stdin.readlines():
   if flag == 0:
       num.append(line)
       flag = 1
   elif flag == 1:
       num.append(line)
       flag = 2
   if flag == 2:
       flag = 0
       hit_blow(num)
       del num[:]

Solution (Python):
while True:
	try:
		A=[int(i) for i in input().split()]
		B=[int(i) for i in input().split()]
		
		hit=0
		for i in range(len(A)):
			if A[i]==B[i]:
				hit+=1
		
		blow=0
		for i in range(len(A)):
			for j in range(len(A)):
				if i!=j:
					if A[i]==B[j]:
						blow+=1

		print(hit,blow)



	except EOFError:
		break

Solution (Python):
while True:
    try:
        x = list(map(int,input().split()))
    except:
        break
    y = list(map(int,input().split()))
    h, b = 0, 0
    for i in range(4):
        if x[i] == y[i]:
            h += 1
        elif y[i] in x:
            b += 1
    print(h, b)

Solution (Python):

import sys
hit, brow = 0, 0
a, b = [], []
for i in sys.stdin:
    a.append(map(int, i.split()))

for i in xrange(0,len(a),2):
    for j in xrange(4):
        if a[i][j] == a[i + 1][j]:
            hit += 1
        elif a[i + 1][j] in a[i]:
            brow += 1

    print hit, brow
    brow, hit = 0, 0

Solution (Python):
import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)

n = len(inputs)
for _ in range(n // 2):
    a = list(map(int, inputs[_ * 2].split()))
    b = list(map(int, inputs[_ * 2 + 1].split()))
    hit = 0
    blow = 0
    for i in range(4):
        if b[i] == a[i]:
            hit += 1
        elif b[i] in a:
            blow += 1
    print(hit, blow)

Solution (Python):


import sys

lines = sys.stdin.readlines()
for i in range(len(lines)/2):
    line1 = lines[2*i]
    line2 = lines[2*i+1]
    hit = blow = 0
    A = map(int, line1.split())
    B = map(int, line2.split())
    for i in range(4):
        if A[i] == B[i]:
            hit += 1
    for i in range(4):
        for j in range(4):
            if A[i] == B[j]:
                blow += 1
                break
    blow -= hit
    print "%d %d" %(hit, blow)

Solution (Python):
import sys
Lines = sys.stdin.readlines()

for i in range(0, len(Lines), 2):
    Anumbers = list(map(int, Lines[i].split()))
    Bnumbers = list(map(int, Lines[i+1].split()))
    Hit = 0    
    for j in range(len(Anumbers)):
        Hit += 1 if (Anumbers[j] == Bnumbers[j]) else 0
    Blow = len(set(Anumbers) & set(Bnumbers)) - Hit
    print(Hit, Blow)

Solution (Python):
while 1:
    try:
        a=map(int,raw_input().split())
        b=map(int,raw_input().split())
        hi=0
        bl=0
        for i in xrange(4):
            for j in xrange(4):
                if i==j:
                    if a[i]==b[j]:
                        hi+=1
                else:
                    if a[i]==b[j]:
                        bl+=1
        print hi,bl
    except:
        break

Solution (Python):
import sys
for line in sys.stdin:
    arrA,arrB = [],[]
    s = line.split()
    for i in s:
        arrA.append(int(i))
    s = input().split()
    for i in s:
        arrB.append(int(i))
    h,b = 0,0
    for i in range(len(arrA)):
        if arrA[i] == arrB[i]:
            h += 1
        elif arrB.count(arrA[i]) > 0:
                b += 1
    print(h,b)

Solution (Python):
try:
    while 1:
        a = input().split()
        b = input().split()
        s = 0
        v = 0
        for i in range(len(a)):
            if a[i] == b[i]:
                s += 1
            elif a[i] in b:
                v += 1

        print(*(s, v))
except:
    pass

Solution (Python):



def main(a, b):
    hit = 0
    blow = 0

    for a_e, b_e in zip(a, b):
        if a_e == b_e:
            hit += 1
        elif a_e in b:
            blow += 1

    print(hit, blow, sep=' ')

while True:
    try:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]
    except:
        break

    main(a, b)

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

Solution (Python):
while True:

  try:

    a = map(int, raw_input().split())
    b = map(int, raw_input().split())

    hit = blow = 0

    for i in range(4):

      if(a[i] == b[i]):
        hit += 1

      elif(a[i] in b):
        blow += 1

    print hit, blow

  except EOFError:
    break

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

Solution (Python):
while 1:
    try:
        a = map(int, raw_input().split())
        b = map(int, raw_input().split())
        for i in xrange(3, -1, -1):
            if a[i] == b[i]:
                del a[i]
                del b[i]
        print str(4 - len(a)) + " " + str(len(set(a) & set(b)))
    except:
        break

Solution (Python):
while True:
    try:
        ansa=input().split()
        ansb=input().split()
    except:
        break

    hit = sum((1 for a, b in zip(ansa, ansb) if a == b))
    blow = sum((1 for a in ansa if a in ansb))

    print(hit, blow - hit)

Solution (Python):
import sys

a = []
for line in sys.stdin:
    a.append(line)

time=0
for n in a:
    if time==0:
        Alist=n.split()
        time=1
    else:
        Blist=n.split()
        hit=0
        blow=0
        for i in range(4):
            if Blist[i]==Alist[i]:
                hit+=1
            else:
                if Blist[i] in Alist:
                    blow+=1
        time=0
        print hit,blow

Solution (Python):
import sys

state = True
for s in sys.stdin:
    if state:
        state = not state
        a = list(map(int,s.split()))
    else:
        state = not state
        b = list(map(int,s.split()))
        hit = 0
        for i in range(len(a)):
            if a [i] == b [i]:
                hit += 1
        blow = -hit
        for i in range(10):
            blow += min(a.count(i),b.count(i))
        print(hit,blow)

Solution (Python):
import sys

turn = -1
for line in sys.stdin:
    turn += 1
    if turn%2 == 0:
        A = map(int, line.rstrip().split())
        continue
    else:
        B = map(int, line.rstrip().split())

    hit, blow = 0, 0
    for i, b in enumerate(B):
        if A[i] == b:
            hit += 1
        elif b in A:
            blow += 1
    print hit, blow

Solution (Python):
import sys

Even = True
for s in sys.stdin:
    if Even:
        Even = False
        a = list(map(int, s.split()))
    else:
        Even = True
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Solution (Python):
import sys

even = True
for s in sys.stdin:
    if even:
        even = False
        a = list(map(int, s.split()))
    else:
        even = True
        b = list(map(int, s.split()))
        hit = sum(a[i] == b[i] for i in range(4))
        blow = sum(b[i] in a for i in range(4)) - hit
        print(hit, blow)

Solution (Python):
while True:
    try:
        hit = 0
        brow = 0
        Anum = list(map(int,input().split()))
        Bnum = list(map(int,input().split()))
        for i in range(4):
            if Anum[i] == Bnum[i]:
                hit += 1
            elif Bnum[i] in Anum:
                brow +=1
        print(hit,brow)
                
                       
    except EOFError:
        break

Solution (Python):
import sys
while(True):
    try:
        hit=0
        blow=0
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
        for i in range(len(a)):
            for j in range(len(b)):
                if a[i]==b[j]:
                    if i==j:
                        hit+=1
                    else:
                        blow+=1
                    break
        print(hit,blow)
    except EOFError:
        sys.exit()

Solution (Python):
import sys

if __name__ == '__main__':
    data = []
    for line in sys.stdin:
        data.append([int(x) for x in line.strip().split(' ')])
        if len(data) == 2:
            choice_a = data[0]
            choice_b = data[1]
            data = []

            
            

            
            hit = 0
            blow = 0








            for i, d in enumerate(choice_a):
                if d in choice_b:
                    if d == choice_b[i]:
                        hit += 1
                    else:
                        blow += 1

            
            print('{0} {1}'.format(hit, blow))

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit = sum(1 for x, y in zip(a, b) if x == y)
        hits = [x for x, y in zip(a, b) if x == y]
        blow = sum(1 for x in a if x in b and x not in hits)
        print(hit, blow)
    except:
        break

Solution (Python):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:
        break
    hit,blow=0,0
    for i,j in zip(a,b):
        if i==j:
            hit+=1
        elif j in a:
            blow+=1
    print(hit,blow)

Solution (Python):
def hit_blow(a,b):
    hit = 0
    blow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
    for i in range(4):
        for j in range(4):
            if a[i] == b[j]:
                blow += 1
    blow -= hit
    print(hit,blow)
    return 0

while True:
    try:
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
        hit_blow(a,b)
    except EOFError:
        break

Solution (Python):
while 1:
    try:a=list(map(int,input().split()))
    except:break
    b=list(map(int, input().split()))
    h=0
    for i in range(4):
        if a[i]==b[i]: h+=1
    print(h,len(set(a)&set(b))-h)

Solution (Python):
while 1:
    try:a=list(map(int,input().split()))
    except:break
    b=list(map(int, input().split()))
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Solution (Python):
import sys

while True:
  a = sys.stdin.readline()
  if not a: break

  a = a.rstrip().split(" ")
  b = raw_input().rstrip().split(" ")

  hit=0
  for i in range(len(a)):
    if a[i] == b[i]:
      hit+=1
      a[i] = -1

  blow=0
  for e in b:
    if e in a:
      blow+=1

  print("{} {}").format(hit, blow)

Solution (Python):
while True:
    try:
        hit = 0
        blow = 0
        hit_idx = []
        s = list(map(int, input().split()))
        t = list(map(int, input().split()))
        for i in range(4):
            if s[i] == t[i]:
                hit_idx.append(i) 
        hit = len(hit_idx)                                
        for i in hit_idx[::-1]:     
            s = s[:i] + s[(i+1):]
            t = t[:i] + t[(i+1):]
        for c in s:
            if c in t:
                blow += 1
                                
        print("%d %d" % (hit,blow)) 
    except:
        break

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))

        hit = 0
        blow = 0

        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                blow += 1

        print(hit,blow)

    except EOFError:
        break

Solution (Python):
import sys
array = []
for i in sys.stdin.readlines():
    array.append(i.rstrip().split())
for i in range(0,len(array),2):
    hit = 0
    blow = 0
    for i2 in range(4):
        if array[i][i2] == array[i+1][i2]:
            hit += 1
        for i3 in range(4):
            if array[i][i2] == array[i+1][i3]:
                if i2 == i3:
                    continue
                blow += 1
    print(str(hit)+" "+str(blow))

Solution (Python):
import sys

v = None
for i in sys.stdin:
    if v:
        h = 0
        for j, n in enumerate(i.split()):
            if n == v[j]:
                h += 10
            elif n in v:
                h += 1
        v = None
        print(h // 10, h % 10)
    else:
        v = i.split()

Solution (Python):


import sys
import os
import math

lines = sys.stdin.readlines()
game_num = len(lines) // 2

for i in range(game_num):
    s0 = lines[2 * i].strip()
    s1 = lines[2 * i + 1].strip()

    A = list(map(int, s0.split()))
    B = list(map(int, s1.split()))

    hit = 0
    blow = 0
    for j in range(4):
        if A[j] == B[j]:
            hit += 1
        elif A[j] in B:
            blow += 1
    print(hit, blow)

Solution (Python):
while True :
    try :
        a = [int(_) for _ in input().split()]
        b = [int(_) for _ in input().split()]
        hit, blow = 0, 0
        for _ in range(4) :
            if a[_] == b[_] : hit += 1
            elif b[_] in a : blow += 1
        print(hit, blow)
    except : break

Solution (Python):
while True:
    try:
        a, b = list(map(int,input().split())), list(map(int, input().split()))
        print(sum([1 for i in range(4) if a[i] == b[i]]),
              sum([1 for i in range(4) for j in range(4) if i != j and a[i] == b[j]]))
    except:
        break

Solution (Python):
def HB(A,B):
    hit=0
    blow=0
    for i in range(4):
        for j in range(4):
            if A[i]==B[j]:
                if i==j:
                    hit+=1
                else:
                    blow+=1
    return [hit,blow]
while True:
    try:
        A=input().split()
        B=input().split()
        print(HB(A,B)[0] , HB(A,B)[1] )
    except:
        break

Solution (Python):
try:
    while True:
        l1 = list(map(int, input().split()))
        l2 = list(map(int, input().split()))
        hit = blow = 0
        for i in l1:
            for s in l2:
                if i == s:
                    if l1.index(i) == l2.index(s):
                        hit += 1
                    else:
                        blow += 1
        print(hit, blow)
except:
    pass

Solution (Python):
try:
 while True:
  l1=list(map(int,input().split()))
  l2=list(map(int,input().split()))
  hit=blow=0
  for i in l1:
    for s in l2:
     if i==s:
      if l1.index(i)==l2.index(s):
        hit+=1
      else:
        blow+=1
  print(hit,blow)
except:
  pass

Solution (Python):
while True:
    try:
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))
    except EOFError:
        break
    hit = sum(1 for i in range(4) if A[i] == B[i])
    blow = sum(1 for i in range(4) if A[i] in B) - hit
    print(hit, blow)

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    print(sum(x == y for x, y in zip(a, b)),  sum(a[i] != b[i] and a[i] in b for i in range(4)))

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    print(sum(x == y for x, y in zip(a, b)), sum(a[i] != b[i] and a[i] in b for i in range(4)))

Solution (Python):
import sys

for user in sys.stdin:
    hit = 0
    blow = 0
    a = list(map(int, user.split()))
    user = input()
    b = list(map(int, user.split()))
    for i in range(4):
        for j in range(4):
            if b[i] == a[j]:
                if i == j:
                    hit += 1
                else:
                    blow += 1

    print(hit, blow)

Solution (Python):
import sys
for line in sys.stdin:
    hit = 0
    blow = 0
    if line == "\n":
        break
    A = line.split()
    B = [n for n in input().split()]
    for i in B:
        if i in A:
            if A.index(i) == B.index(i):
                hit += 1
            else:
                blow += 1
    print(hit, blow)

Solution (Python):
import sys
def main():
    for line in sys.stdin:
        a = list(map(int, line.split()))
        b = list(map(int, input().split()))

        hi, bl = 0, 0
        for x in range(4):
            for y in range(4):
                if a[x] == b[y]:
                    if x == y:
                        hi += 1
                    else:
                        bl += 1

        print(hi, bl)


if __name__ == "__main__":
    main()

Solution (Python):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def hit_and_blow(A, B):
    hit, blow = 0, 0
    for k in range(4):
        if A[k] == B[k]:
            hit += 1
        elif A[k] in B:
            blow += 1
    return hit, blow


while True:
    try:
        A = [int(_) for _ in input().split()]
    except EOFError:
        break
    B = [int(_) for _ in input().split()]
    hit, blow = hit_and_blow(A, B)
    print(hit, blow)

Solution (Python):
def check(collect, answer):
    hit = sum(1 for a, c in zip(answer, collect) if a is c)
    blow = len(set(collect) & set(answer)) - hit
    return (hit, blow)

while True:
    try:
        print(*check(input().split(), input().split()))
    except EOFError:
        break

Solution (Python):



def hit_and_blow(answer: list, expect: list) -> tuple:
    hit, blow = 0, 0
    for (i, j) in zip(answer, expect):
        if i == j:
            hit += 1
    answer_set = set(answer)
    expect_set = set(expect)
    blow_set = answer_set & expect_set
    blow = len(blow_set) - hit
    return hit, blow


if __name__ == '__main__':
    while True:
        try:
            answer_number = list(map(int, input().split()))
            expected_number = list(map(int, input().split()))
        except EOFError:
            break
        h, b = hit_and_blow(answer_number, expected_number)
        print(h, b)

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
    except:
        break
    hit = 0
    blow = 0
    for i, n in enumerate(a):
        if b[i] == n:
            hit += 1
        elif n in b:
            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
        bro=0
        for i in range(4):
            if a[i]==b[i]:
                hit=hit+1
            for j in range(4):
                if a[i]==b[j]:
                    bro=bro+1
        print(hit,bro-hit)
    except:break

Solution (Python):
while True:
  try:
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    hit = blow = 0
    for i in range(len(A)):
      if A[i] == B[i]:
        hit += 1
    print(hit, end=" ")
    for b in B:
      if A.count(b) > 0:
        blow += 1
    print(blow - hit)
  except:
    break

Solution (Python):
def main():
    while True:
        try:
            A = list(map(int,input().split()))
            B = list(map(int,input().split()))
            hit_count = 0
            blow_count = 0
            for i in range(4):
                for j in range(4):
                    if A[i] == B[i]:
                        hit_count += 1
                        break
                    if A[i] == B[j]:
                        blow_count += 1
                        break
            print(str(hit_count)+ " " + str(blow_count))
        except EOFError:
            break




if __name__ == '__main__':
    main()

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit  = 0
        blow = 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                blow += 1
        print(hit, blow)
    except:
        break

Solution (Python):
while True:
    try:
        a = list(map(int, input().split()))
        b = list(map(int, input().split()))
        hit  = 0
        blow = 0
        for i in range(4):
            if a[i] == b[i]:
                hit += 1
            elif a[i] in b:
                blow += 1
        print(hit, blow)
    except:
        break

Solution (Python):
while True:
    try:
        Hflag,Bflag=0,0
        a = map(int,raw_input().split())
        b = map(int,raw_input().split())
        for i in range(4):
            if a[i] == b[i]:
                Hflag += 1
            else:
                continue
        for j in range(4):
            for k in range(4):
                if a[j] == b[k]:
                    Bflag += 1
                else:
                    continue
        Bflag = Bflag - Hflag
        print Hflag, Bflag
    except:
        break

Solution (Python):
while True:
    hit=0
    bro=0
    try:
        a = [int(i) for i in input().split()]
        b= [int(j) for j in input().split()]
        for g in range(4):
            for p in range(4):
                if a[g]==b[p]:
                    bro+=1
        for l in range(4):
            if a[l]==b[l]:
                hit+=1
                bro-=1
        print(hit,bro)
    except:break

Solution (Python):
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(0,len(N),2):
    a = [int(i) for i in N[l].split()]
    b = [int(i) for i in N[l+1].split()]

    hit = 0
    blow = 0
    for i in range(len(a)):
        for j in range(len(b)):
            if a[i] == b[j]:
                if i == j:
                    hit = hit+1
                else:
                    blow = blow+1
    print(hit,blow)

Solution (Python):
import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=sum([1 for i in range(4)if a[i]==b[i]])
 w=4-len(set(a)-set(b))-h
 print(h,w)

Solution (Python):
import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=sum([1 for i in range(4)if a[i]==b[i]])
 print(h,4-len(set(a)-set(b))-h)

Solution (Python):
import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=0
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

Solution (Python):
import sys
e=iter(sys.stdin)
for a,b in zip(e,e):
 a,b,h=a.split(),b.split(),0
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

Solution (Python):
import sys
e=iter(map(lambda a:a.split(),sys.stdin))
for a,b in zip(e,e):
 h=0
 for s,t in zip(a,b):h+=s==t
 print(h,4-len(set(a)-set(b))-h)

Solution (Python):
while True:
    try:
        a=[int(i) for i in input().split()]
        b=[int(i) for i in input().split()]
    except:break
    hit=sum([1 for i in range(4) if a[i]==b[i]])
    blow=8-len(set(a)|set(b))-hit
    print("{0} {1}".format(hit,blow))

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

Solution (Python):
import sys

a = []
for line in sys.stdin:
    a.append(line.strip())
ita = iter(a)

for a, b in zip(ita, ita):
    hit = 0
    blow = 0
    a = a.split(' ')
    b = b.split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)