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:

a1 a2 a3 a4
b1 b2 b3 b4

, where ai (0 ≤ ai ≤ 9) is i-th number A  imagined and bi (0 ≤ bi ≤ 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



Sample input:
9 1 8 2
4 1 5 9
4 6 8 2
4 6 3 2


Sample output:
1 1
3 0

Submission status: Accepted

Solution code:
while True:
    try:
        h=0
        b=0
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        if a1==b2 or a1==b3 or a1==b4:
            b+=1
        if a2==b1 or a2==b3 or a2==b4:
            b+=1
        if a3==b1 or a3==b2 or a3==b4:
            b+=1
        if a4==b1 or a4==b2 or a4==b3:
            b+=1
        print(h,b)
    except:
        break

Submission status: Accepted

Solution code:
ans = 0
while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow =0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit)+' '+str(brow))

Submission status: Accepted

Solution code:
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):
        if a[i] != b[i]:
            if b[i] in a:
                blow += 1
    print(hit,blow)

Submission status: Accepted

Solution code:
while True:
    try:
        a=0
        b=0
        e1 =list(map(int,input().split()))
        e2 =list(map(int,input().split()))
        for i in range(4):
            if e1[i]==e2[i]:
                a+=1
            for j in range(4):
                if e1[i]==e2[j]:
                   b+=1
        b = b-a
        print(a,b)
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        A = list(map(int, input().split()));
    except EOFError:
        break;
    B = list(map(int, input().split()));

    h = 0;
    b = 0;
    for i in range(0,4):
        if A[i] == B[i]:
            h += 1;
        else:
            for j in range(0,4):
                if A[j] == B[i]:
                    b += 1;
    print(h,b);

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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 i in range(4):
        if a[i]!=b[i]:
            if b[i] in a:
                blow+=1
    
    print(hit,blow)

Submission status: Accepted

Solution code:
while 1:
    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
            for j in range(4):
                if a[i] == b[j]:
                    blow += 1
        blow -= hit
        print(hit, blow)
        
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a=input().split()
        b=input().split()
        hit=0
        blow=0

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

        print(hit, blow)
        
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a=list(map(str,input().split()))
        b=list(map(str,input().split()))
    except EOFError:
        break
    c,d=0,0
    for i in range(4):
        if a[i]==b[i]:
            c+=1
        elif a[i] in b:
            d+=1
    print(c,d)

Submission status: Accepted

Solution code:
while 1:
    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 b[i] in a:
                blow += 1
        print(hit,blow) 
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split())

        A=[a1,a2,a3,a4]
        B=[b1,b2,b3,b4]

        b=0
        h=0
        for i in A:
            if i in B:
                b+=1
            else:
                continue
        for i in range(4):
            if A[i]==B[i]:
                h+=1
            else:
                continue
        print(h,b-h)
    except EOFError:
        break

Submission status: Accepted

Solution code:
def x(m,n):
    H = 0
    B = 0
    for i in range(4):
        if m[i] == n[i]:
            H += 1
        else:
            if m[i] in n:
                B += 1
    return(H, B)

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

Submission status: Accepted

Solution code:
while True:
    try:
        H=0; B=0;
        a=list(map(int,input().split()))
        b=list(map(int,input().split()))
    except:
        break
    if a[0]==b[0]:
        H+=1
    if a[1]==b[1]:
        H+=1
    if a[2]==b[2]:
        H+=1
    if a[3]==b[3]:
        H+=1
    if a[0]==b[1] or a[0]==b[2] or a[0]==b[3]:
        B+=1
    if a[1]==b[0] or a[1]==b[2] or a[1]==b[3]:
        B+=1
    if a[2]==b[0] or a[2]==b[1] or a[2]==b[3]:
        B+=1
    if a[3]==b[0] or a[3]==b[1] or a[3]==b[2]:
        B+=1
    print(H, B)

Submission status: Accepted

Solution code:
while True:
    try:
        A=list(map(str,input().split()))
        B=list(map(str,input().split()))
        h=0
        b=0
        for i in range(4):
            if A[i] in B:
                b+=1
            if A[i]==B[i]:
                h+=1
        print(h,b-h)
    except EOFError:
        break

Submission status: Accepted

Solution code:
try:
    while True:
        a1,a2,a3,a4=map(int,input().split())
        b1,b2,b3,b4=map(int,input().split()) 
        h=0
        b=0
        if a1==b1:
            h+=1
        if a2==b2:
            h+=1
        if a3==b3:
            h+=1
        if a4==b4:
            h+=1
        A = [a1,a2,a3,a4]
        B = [b1,b2,b3,b4]
    
        for i in A:
            for j in B:
                if i == j:
                    b +=1
        b = b - h
        
        print(h,b)
except EOFError:
    pass

Submission status: Accepted

Solution code:
while True:
   try:
      A = input().split()
      B = input().split()
      h = 0
      b = 0
      for i in range(4):
         for j in range(4):
            if A[i] == B[j]:
               if i == j:
                  h += 1
               else:
                  b += 1
            else:
               pass
      print(h, b)
   except EOFError:
      break

Submission status: Accepted

Solution code:
while True:
    try:
        A = map(int,input().split())
        ls_A = list(A)
        B = map(int,input().split())
        ls_B = list(B)
        h = 0
        b = 0
        for i in range(len(ls_A)):
            if ls_A[i] == ls_B[i]:
                h += 1
        if ls_A[0] == ls_B[1]:
            b += 1
        if ls_A[0] == ls_B[2]:
            b += 1
        if ls_A[0] == ls_B[3]:
            b += 1
        if ls_A[1] == ls_B[0]:
            b += 1
        if ls_A[1] == ls_B[2]:
            b += 1
        if ls_A[1] == ls_B[3]:
            b += 1
        if ls_A[2] == ls_B[0]:
            b += 1
        if ls_A[2] == ls_B[1]:
            b += 1
        if ls_A[2] == ls_B[3]:
            b += 1
        if ls_A[3] == ls_B[0]:
            b += 1
        if ls_A[3] == ls_B[1]:
            b += 1
        if ls_A[3] == ls_B[2]:
            b += 1   
        print(h,b)
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a=list(input())
        b=list(input())
        a=[i for i in a if i!=' ']
        b=[j for j in b if j!=' ']
        hit=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
        print(hit,blow)
    except EOFError:
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
try:
    while True:
        L=0
        M=0
        
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
        
        for i in range(4):
            if A[i]==B[i]:
                L+=1
            
            C=A.count(B[i])
            if C>=1:
                M+=1
                
        print(L,M-L)
        
except EOFError:
    pass

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#0025
while True:
    c = 0
    d = 0
    l = []
    m = []
    try:
        a1,a2,a3,a4 = map(int,input().split())
        b1,b2,b3,b4 = map(int,input().split())
    except:
        break
    l.extend([a1,a2,a3,a4])
    m.extend([b1,b2,b3,b4])

    for i in range(4):
        for k in range(4):
            if l[i] == m[k]:
                if i == k:
                    c += 1
                else:
                    d += 1
    print(c,d)

Submission status: Accepted

Solution code:
while True:
    try:
        a=input().split()
        b=input().split()
    except:
        break
    hit=0
    blow=0
    for i in range(4):
        x=a.count(b[i])
        blow+=x
        if a[i]==b[i]:
            hit+=1
            blow-=1
    print(hit,blow)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

while True:
   try:
      A = list(input())
      B = list(input())
      
      for i in range(A.count(' ')):
         A.remove(' ')
      for i in range(B.count(' ')):
         B.remove(' ')
      #print(A, B)
      
      h = 0 #ブロー数
      b = 0 #ヒット数
      for i in range(4):
         for j in range(4):
            if A[i] == B[j]:
               if i == j:
                  h += 1
               else:
                  b += 1
      print(h, b)

   except EOFError:
      break

Submission status: Accepted

Solution code:
while True:
    try:
        Alst = list(map(int, input().split()))
        Blst = list(map(int, input().split()))
        H = 0
        B = 0

        for a, anum in enumerate(Alst):
            for b, bnum in enumerate(Blst):
                if anum == bnum:
                    if a == b:
                        H = H + 1
                    else:
                        B = B + 1

        print(str(H) + ' ' + str(B))


    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
        C=[]
        for i in range(4):
            if B[i]==A[i]:
                C.append("h")
            elif B[i] in A:
                C.append("b")
            else:
                pass
        H=C.count("h")
        B=C.count("b")
        print(H,B)
    except:
        break

Submission status: Accepted

Solution code:
while True:
	try:
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
	except:
	    break
	
	h = 0
	bl = 0
	
	for i in range(4):
            if a[i] == b[i]:
                h += 1
                b[i] = 51
	for i in range(4):
            if a[i] in b:
                bl += 1
	 
	print(h,bl)

Submission status: Accepted

Solution code:
while True:
    try:
        A=list(map(int,input().split()))
        B=list(map(int,input().split()))
    except:
        break

    h=0
    for i in range(4):
        if A[i]==B[i]:
            h+=1
    b=0
    for i in A:
        if i in B:
            b+=1
    b-=h
    print(h,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True :
    try :
        A = list(input().split())
        B = list(input().split())
        
        hit = 0
        blow = 0
        
        for i in range(4) :
            if A[i] == B[i] :
                hit += 1
                
            elif B[i] in A :
                blow += 1
                
        print(hit, blow)
    
    except :
        break

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    *A, = map(int, readline().split())
    *B, = map(int, readline().split())
    v1 = v2 = 0
    for i in range(4):
        if A[i] == B[i]:
            v1 += 1
        for j in range(4):
            if i != j and A[i] == B[j]:
                v2 += 1
    write("%d %d\n" % (v1, v2))
try:
    while 1:
        solve()
except:
    ...

Submission status: Accepted

Solution code:
while True :
    try :
        a1, a2, a3, a4 = map(int, input().split())
        b1, b2, b3, b4 = map(int, input().split())
    except EOFError :
        break
    
    hit = 0
    brow = 0
    if a1 == b1 :
        hit += 1
    if a2 == b2 :
        hit += 1
    if a3 == b3 :
        hit += 1
    if a4 == b4 :
        hit += 1
    if a1 == b2 or a1 == b3 or a1 == b4 :
        brow += 1
    if a2 == b1 or a2 == b3 or a2 == b4 :
        brow += 1
    if a3 == b1 or a3 == b2 or a3 == b4 :
        brow += 1
    if a4 == b1 or a4 == b2 or a4 == b3 :
        brow += 1
        
    print(hit, brow)

Submission status: Accepted

Solution code:
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
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a:
			    blow += 1
	print(hit, blow)

Submission status: Accepted

Solution code:
try:
    while True:
        #標準入力
        a_line = list(map(int,input().split()))
        b_line = list(map(int,input().split()))
        num1 = 0
        num2 = 0
        #場所も番号も同じならnum1数字が同じならnum2にいれる
        for num in range(0,4):
            if a_line[num] == b_line[num]:
                num1 += 1
                continue
            else:pass
            if a_line[num] in b_line:num2 += 1
            else:pass
        print(str(num1) + " " + str(num2))
#EOFErrorをひろう
except EOFError:
    pass

Submission status: Accepted

Solution code:
while True:
    try:
        alist = input().split()
        blist = input().split()
        hit = brow = 0
        
        for i in range(4):
            for j in range(4):
                if alist[i] == blist[j]:
                    if i == j:
                        hit += 1
                    else:
                        brow += 1
        print(hit,brow)
    except EOFError:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit) + " " + str(brow))

Submission status: Accepted

Solution code:
c = 0
while True:
    try:
        if c % 2 == 0:
            A = [int(x) for x in input().split()]
        else:
            B = [int(x) for x in input().split()]
            hit = blow = 0
            for i in range(len(B)):
                if A[i] == B[i]:
                    hit += 1
                else:
                    if B[i] in A:
                        blow += 1
            print(hit,blow)
                
        c += 1    
    except EOFError:
        break

Submission status: Accepted

Solution code:
"""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
			b[i] = -1
	for i in range(4):
		if b[i] >= 0:
			if b[i] in a: blow += 1
	print(hit, blow)
"""
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
            b[i] = -1
    for i in range(4):
        if b[i] >= 0:
            if b[i] in a:
                 blow += 1
    print(hit, blow)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':

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

			hit = 0
			blow = 0
			for i in range(4):
				if A[i] == B[i]:
					hit += 1
				else:
					if B[i] in A:
						blow += 1

			print(hit,blow)

		except EOFError:
			break

Submission status: Accepted

Solution code:
while 1:
   try:
       h = 0
       b = 0
       que=input().split(" ")
       ans=input().split(" ")
       for i in range(4):
             for j in range(4):
                    if que[i] == ans[j] and i != j:
                         b = b + 1
                    if que[i] == ans[j] and i == j:
                         h = h + 1
       print(str(h) + " " + str(b))
   except:break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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 )
#print(lines)
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)):
    #print(x, y, y in xs)
    if x == y:
      full_match += 1
    elif y in xs:
      spec_match += 1
  print(full_match, spec_match)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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

Submission status: Runtime Error

Solution code:
import sys
for line in sys.stdin:
    hit = 0
    blow = 0
    a_nums = line.split()
    for i_b, b in input().split():
        try:
            i = a_nums.index(b)
            if i == i_b:
                hit += 1
            else:
                blow += 1
        except ValueError:
            continue
    print(hit, blow)

Submission status: Runtime Error

Solution code:
import sys
for i in sys.stdin:
    arrA,arrB = [],[]
    s = i.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
        else:
            if arrB.count(arrA[i]) > 0:
                b += 1
    print(h,b)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


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=' ')


if __name__ == '__main__':
    while True:
        a = [int(e) for e in input().split()]
        b = [int(e) for e in input().split()]

        if a and b:
            main(a, b)
        else:
            exit()

Submission status: Runtime Error

Solution code:
while True:

  a = map(int, raw_input().split())
  b = map(int, raw_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

Submission status: Runtime Error

Solution code:
while True:

  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

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

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

            #print(choice_a)
            #print(choice_b)

            # hit&blow?????????
            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))

Submission status: Runtime Error

Solution code:
import sys
v = iter(sys.stdin.readlines())
for i, j in v, v:
    a, b = list(i.sprit()), list(j.split())
    k = len([n for n in a for m in b if n == m])
    l = len(set(a) & set(b))
    print(l, k-l)

Submission status: Runtime Error

Solution code:
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)