Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

Python: 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)

Python: 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

Python: 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)

Python: # -*- 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=' ')


a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]

main(a, b)

Python: 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)

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)

Python: import sys
for line in sys.stdin:
    a = list(map(int, line.split()))
    b = list(map(int, line.split()))
    hit, brow = 0, 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        elif a[i] in b:
            brow += 1
    print(hit, brow)

Python: 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

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

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)

Python: # coding=utf-8


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
    print(blow_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)

Python: 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

Python: import sys
inputs = []
for line in sys.stdin:
    inputs.append(line)
n = len(inputs)
for _ in range(n // 2):
    for line in sys.stdin:
        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)

Python: 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

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

Python: # -*- coding: utf-8 -*-

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

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

Python: 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