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: Runtime Error

Solution code:
import fileinput
for line in fileinput.input():
    a = line.split()
    b = input().split()
    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
    print(hit, blow)

Submission status: Runtime Error

Solution code:
import sys 
import numpy as np 

def main():
    input_line = []
#     test_line = ['9 1 8 2', '4 1 5 9', '4 6 8 2', '4 6 3 2']
    
#     for line in test_line:
#         input_line.append(line.split())
    
    
    
    for line in sys.stdin:
        input_line.append(line.split())
    #print(input_line)

    
    for i in range(0,len(input_line),2):
        #hit number
        arrary1 = np.array(input_line[i], dtype=float)
        arrary2 = np.array(input_line[i+1], dtype=float)
        hit_vec = arrary1 - arrary2
        hit_list = list(hit_vec)
        hitnumber = hit_list.count(0.)
        #print(hit_list.count(0.))
        
        #blow number
        
        
        
        
        #get the hit location and remove
        hit_loc = [i for i,x in enumerate(hit_list) if x == 0]
        blow_vec1 = np.delete(arrary1, hit_loc)
        blow_vec2 = np.delete(arrary2, hit_loc)
        blownumber = len(set(blow_vec1).intersection(blow_vec2))
        #print(len(set(blow_vec1).intersection(blow_vec2)))
        
        print(hitnumber,blownumber)


        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = [*map(int,input().split(' '))]
b = [*map(int,input().split(' '))]
for i in range(4):
	if a[i] == b[i]:
		hit += 1
	if a[i] == b[i-1]:
		blow += 1
print(hit, blow)

Submission status: Runtime Error

Solution code:
hit = blow = 0
a = [*map(int,input().split(' '))]
b = [*map(int,input().split(' '))]
for i in range(4):
	if a[i] == b[i]:
		hit += 1
		elif a[i] == b[i-1]:
			blow += 1
print(hit, blow)

Submission status: Runtime Error

Solution code:
a = [*map(int,input().split(' '))]
b = [*map(int,input().split(' '))]
for i in range(4):
	if a[i] == b[i]:
		hit += 1
		elif a[i] == b[i-1]:
			blow += 1
print(hit, blow)

Submission status: Runtime Error

Solution code:
while True:
    hit = 0
    blow = 0
    a = input().split(' ')
    b = input().split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
ans = []
for line in sys.stdin:
    aa = list(map(int,input().split()))
    bb = list(map(int,input().split()))
    hit = 0
    blow = 0
    for one in range(len(aa)):
        if aa[i] == bb[i]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi and one_a != one_b:
                blow += 1
    one_list = [hit,blow]
    ans.append(one_list)

for i in range(len(ans)):
    print(str(ans[i][0]) + ' ' + str(ans[i][1]))

Submission status: Runtime Error

Solution code:
import sys
ans = []
for line in sys.stdin:
    aa = list(map(int,input().split()))
    bb = list(map(int,input().split()))
    hit = 0
    blow = 0
    for one in range(len(aa)):
        if aa[i] == bb[i]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi and one_a != one_b:
                blow += 1
    one_list = [hit,blow]
    ans.append(one_list)

for i in range(len(ans)):
    print(str(ans[i][0]) + ' ' + str(ans[i][1]) + ' ')

Submission status: Runtime Error

Solution code:
import sys
ans = []
for line in sys.stdin:
    aa = list(map(int,input().split()))
    bb = list(map(int,input().split()))
    hit = 0
    blow = 0
    for one in range(len(aa)):
        if aa[i] == bb[i]:
            hit += 1
            
    for one_a in range(len(aa)):
        ai = aa[one_a]
        for one_b in range(len(bb)):
            bi = bb[one_b]
            if ai== bi and one_a != one_b:
                blow += 1
    one_list = [hit,blow]
    ans.append(one_list)

for i in range(len(ans)):
    print(str(ans[i][0]) + ' ' + str(ans[i][1]))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    while 1:
        try:
            a = [int(x) for x in raw_input().split(" ")]
            b = [int(x) for x in raw_input().split(" ")]
        except EOFError:
            return
        print "%d %d" % hit_and_blow(a, b)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    try:
        a = [int(x) for x in raw_input().split(" ")]
        b = [int(x) for x in raw_input().split(" ")]
    except EOFError:
        return
    print "%d %d" % hit_and_blow(a, b)
    main()

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    while 1:
        try:
            a = [int(x) for x in raw_input().split(" ")]
            b = [int(x) for x in raw_input().split(" ")]
        except EOFError:
            pass
        print "%d %d" % hit_and_blow(a, b)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    inputs = []
    while 1:
        try:
            inputs.append([int(x) for x in raw_input().split(" ")])
        except EOFError:
            break
    print "%d %d" % hit_and_blow(inputs[0], inputs[1])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    inputs = []
    while 1:
        try:
            inputs.append([int(x) for x in raw_input().split(" ")])
        except EOFError:
            break
    quads = []
    for quad in inputs:
        quads.append(quad)
        if quads.__len__() == 2:
            print "%d %d" % hit_and_blow(*quads)
            quads = []

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def hit_and_blow(a, b):
    hits = 0
    blows = 0
    for i in xrange(4):
        if b[i] == a[i]:
            hits += 1
        else:
            for j in xrange(4):
                if j == i:
                    continue
                if b[i] == a[j]:
                    blows += 1
    return hits, blows


def main():
    while 1:
        try:
            a = [int(x) for x in raw_input().split(" ")]
        except EOFError:
            break
        b = [int(x) for x in raw_input().split(" ")]
        print "%d %d" % hit_and_blow(a, b)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

while True:
    try:
        listA = map(int,raw_input().split(' '))
        listB = map(int,raw_input().split(' '))

        hit=0
        blw=0
        for tB in listB:
            if (tB in listA) and (listB.index(tB) == listA.index(tB)):
                hit += 1
            elif (tB in listA) and (listB.index(tB) != listA.index(tB)):
                blw += 1
        print hit,blw

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    while True:
        try:
            hit = 0
            br = 0
            a = map(int,raw_input().split(' '))
            b = map(int,raw_input().split(' '))

            for i in range(4):
                for j in range(4):
                    if a[i] == b[j]:
                        print a[i],b[j]
                        hit += 1
                    elif a[i] == b[j]:
                        br += 1

            print hit,br

        except EOFError:
            break

Submission status: Runtime Error

Solution code:
    while True:
        try:
            hit = 0
            br = 0
            a = map(int,raw_input().split(' '))
            b = map(int,raw_input().split(' '))

            for i in range(4):
                for j in range(4):
                    if a[i] == b[j]:
                        print a[i],b[j]
                        hit += 1
                    elif a[i] == b[j]:
                        br += 1

            print hit,br

        except EOFError:
            break

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    while True:
        try:
            hit = 0
            br = 0
            a = map(int,raw_input().split(' '))
            b = map(int,raw_input().split(' '))

            for i in range(4):
                for j in range(4):
                    if a[i] == b[j]:
                       

                        hit += 1
                    elif a[i] == b[j]:
                        br += 1

            print hit,br

        except EOFError:
            break

Submission status: Runtime Error

Solution code:
while True:
    try:
        hit = 0
        br = 0
        a = map(int,raw_input().split(' '))
        b = map(int,raw_input().split(' '))

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

        print hit,br

    except EOFError:
        break

Submission status: Runtime Error

Solution code:
import sys

for lineCnt, line in enumerate(sys.stdin):
    if lineCnt % 2 == 0:
        a = map(int, line.split(' '))
        continue
    else:
        b = map(int, line.split(' '))
        
    hit = blow = 0
    for i, na in enumerate(a):
        if b[i] == na:
             hit += 1
        elif na in b:
            blow += 1
    print '%d %d' % (hit, blow)

Submission status: Runtime Error

Solution code:
import sys

for lineCnt, line in enumerate(sys.stdin):
    if lineCnt % 2 == 0:
        a = map(int, line.split(' '))
        continue
    else:
        b = map(int, line.split(' '))
        
    hit, blow = 0,0
    for i, na in enumerate(a):
        if b[i] == na:
             hit += 1
        elif na in b:
            blow += 1
    print '%d %d' % (hit, blow)