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

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

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)

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)

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

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

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  vector<int> a(4), b(4);
  while (cin >> a[0]) {
    for (int i = 1; i < 4; i++) cin >> a[i];
    for (int i = 0; i < 4; i++) cin >> b[i];
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      if (find(b.begin(), b.end(), a[i]) != b.end()) {
        if (a[i] == b[i]) hit++;
        else blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
}

C++: #include <stdio.h>
int main(){
	int a[4],b[4];
	int hit,blow;
	while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		hit=blow=0;
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
			for(int j=0;j<4;j++){
				if(i!=j){
					if(a[i]==b[j]) blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

C++: #include <set>
#include <array>
#include <iostream>

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
  	blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size()) << std::endl;
    blowing.clear();
  }
return 0;
}

C++: #include<stdio.h>

int main(){
    /*    int m[10];
    int i,j,k;

    for(i = 0; i < 10; i++){
        scanf("%d",&m[i]);
    }

    for(j = 0; j < 9; j++){
        for(k = 0; k < 9-j; k++){
            if(m[k] < m[k+1]){
                int num = m[k+1];
                m[k+1] = m[k];
                m[k] = num;
            }
        }
    }

    for(i = 0; i < 3; i++){
        printf("%d\n",m[i]);
    }
    */

    while(1){

        int x[4],y[4];
        int i,j;
        int hit = 0,blow = 0;
        int res = scanf("%d%d%d%d",&x[0],&x[1],&x[2],&x[3]);
        if(res==EOF) break;

        for(i = 0; i < 4; i++){
            scanf("%d", &y[i]);
        }

        for(i = 0; i < 4; i++){
            if(x[i] == y[i]){
                hit++;
            }
        }
        for(i = 0; i < 4; i++){
            for(j = 0; j < 4; j++){
                if(x[i] == y[j] && i != j){
                    blow++;
                }
            }
        }

        printf("%d %d\n",hit,blow);
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int a[4], b[4];
	int hit = 0, brow = 0;
	for(int i = 0;i < 4;i++){
		cin >> a[i];
	}
	for(int i = 0;i < 4;i++){
		cin >> b[i];
	}

	for(int i = 0;i < 4;i++){
		for(int j = 0;j < 4;j++){
			if(a[i] == b[j]){
				if(i == j) hit++;
				else brow++;
			}
		}
	}

	cout << hit << " " << brow << endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a[10],b[10];
  int hit=0,blow=0;
  while(scanf("%d",&a[0])!=EOF){
    for(int i=1;i<4;i++){
      cin >> a[i];
    }
    for(int i=0;i<4;i++){
      cin >> b[i];
    }
    hit=0;
    blow=0;
    for(int i=0;i<4;i++){
      if(a[i]==b[i]){
	hit++;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(a[i]==b[j]){
	  blow++;
	}
      }
    }
    blow-=hit;
    cout << hit << " " << blow << endl;
  }
  return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int a[4],b[4];
   int hit,blow;
   while(cin>>a[0])
   {
     hit=blow=0;
     for(int i=1;i<4;i++) cin>>a[i];
     for(int i=0;i<4;i++) cin>>b[i];
     for(int i=0;i<4;i++) if(a[i]==b[i]) hit++;
     for(int i=0;i<4;i++)
     {
       for(int j=0;j<4;j++)
       {
         if(j==i) j++;
         if(a[i]==b[j]) blow++;        
       }        
     }
     cout<<hit<<" "<<blow<<endl;
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
//#define scanf scanf_s

int a[4]; int b[4];

int main()
{
	while (cin >> a[0])
	{
		FOR(i, 1, 4) cin >> a[i];
		REP(i, 4) cin >> b[i];
		int hit = 0;
		int blow = 0;
		REP(i, 4)
		{
			if (a[i] == b[i]) hit++;
			else
			{
				REP(j, 4)
				{
					if (a[i] == b[j]) blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}