Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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

int main(void)
{
	int a[4],b[4];

	while(cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()){
		cin >> b[0] >> b[1] >> b[2] >> b[3];

		int hit = 0, blow = 0;
		int num[10] = {};

		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				b[i] = 0;
			}
			num[a[i]]++;
		}
		for(int i = 0; i < 4; i++)
			if(num[b[i]] > 0)
				blow++;
		

		cout << hit << ' ' << blow << endl;
	}



	return 0;
}

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

int main() {
    int o;
     while(cin>>o){
	int d[3],c[3],y,g=0,b=0;
    d[0]=o;
    for(int i=1;i<8;i++){
       cin>>y;
       if(i<4){
           d[i]=y;
        }
       else{
          c[i]=y;
       }
     }

    for(int j=0;j<4;j++){
     if(d[j]==c[j]){
       g++;
      }
      for(int k=0;k<4;k++){
         if(d[j]==c[k] &&  j!=k){
            b++;
         }
       }
     }
     cout<<g<<" "<<b<<endl;
    }
    
	return 0;
}

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

int main(){

	int a1, a2, a3, a4, b1, b2, b3, b4;

	while(std::cin >> a1 >> a2 >> a3 >> a4){
		
		std::cin >> b1 >> b2 >> b3 >> b4;

		std::array<int, 4> A = {a1, a2, a3, a4};
		std::array<int, 4> B = {b1, b2, b3, b4};
		
		int hit = 0;
		int blow = 0;

		for(int i = 0; i < 4; ++i){
			
			if(A[i] == B[i])
				++hit;
				
			blow += std::count(A.begin(), A.end(), B[i]);

		}

		std::cout << hit << blow << std::endl;
	}

		return 0;

}

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

using std::cin;

int main()
{
    std::array<int, 4> a, b;
    while (cin >> a.at(0)) {
        for (auto i = 1; i < 4; i++) {
            cin >> a.at(i);
        }
        for (auto i = 0; i < 4; i++) {
            cin >> b.at(i);
        }

        int hit = 0, blow = 0;
        for (auto i = 0; i < 4; i++) {
            for (auto j = 0; j < 4; j++) {
                if (a.at(i) == b.at(j)) {
                    if (i == j) {
                        hit++;
                    } else {
                        blow++;
                    }
                }
            }
        }

        std::cout << hit << " " << blow << std::endl;
    }

    return 0;
}

C++: 
#include <iostream>
//#include <fstream>
using namespace std;

int main(void)
{
	int A[4], B[4];
	int res[4], hit, blow;

	//ifstream fin("in.txt");
	istream& in=cin;

	while(1)
	{
		for(int i=0; i<4; i++)
			{ if( !(in >> A[i]) )return 0; }
		for(int i=0; i<4; i++)
			{ if( !(in >> B[i]) )return 0; }


		for(int i=0; i<4; i++)
			res[i] = 0;
		for(int i=0; i<4; i++)
		{
			if(A[i] == B[i])
			{
				res[i] = 1;
			}
			else
			{
				for(int j=0; j<4; j++)
					if(A[j] == B[i])res[i] = 2;
			}
		}

		hit=0; blow=0;
		for(int i=0; i<4; i++)
		{
				 if(res[i] == 1)hit++;
			else if(res[i] == 2)blow++;
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int aa[10];
int bb[10];

int main()
{
	int a[4];
	int b[4];

	int n;
	while (cin >> n){
		a[0] = n;
		REP(i, 3){
			cin >> a[i+1];
		}

		REP(i, 4){
			cin >> b[i];
		}

		REP(i, 10){
			aa[i] = bb[i] = -1;
		}


		REP(i, 4){
			aa[a[i]] = i;
			bb[b[i]] = i;
		}

		int blow = 0;
		int hit = 0;

		REP(i, 10){
			if (aa[i] >= 0){
				if (bb[i] >= 0){
					if (aa[i] == bb[i])
						++hit;
					else
						++blow;
				}
			}
		}

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

}

C++: #include<iostream>
#include<vector>

int main()
{
	std::vector<int> a(4);

	std::vector<int> b(4);

	int hit,blow;

	for(;;)
	{
		for(int i=0;i<4;++i)
		{
			std::cin >> a[i];
		}

		for(int i=0;i<4;++i)
		{
			std::cin >> b[i];
		}

		if(std::cin.eof())
		{
			break;
		}

		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(i!=j && b[i]==a[j])
				{
					++blow;
				}
			}
		}

		std::cout << hit << ' ' << blow << '\n';
	}
}

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

int main() {
	int a[4],b[4];
	int hit,blow;
	
	while ( cin >> a[0] ){
		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++ ) {
			for ( int j = 0; j < 4; j++ ) {
				if ( a[i] == b[j] ) {
					if ( i == j ) {
						hit++;
					}else{
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

int main(){
  int a[4],c[4];
  while(1){
    int e=0,b=0,k;
    for(int i=0;i<4;i++)
      k=scanf("%d",&a[i]);
    if(k==-1)break;
    for(int i=0;i<4;i++){
      cin >> c[i];
      for(int j=0;j<4;j++)
	if(c[i]==a[j]){
	  if(i==j)e++;
	  else b++;
	}
    }
    cout<<e<<' '<<b<<endl;
  }
  return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	vector<int> a(4);
	vector<int> b(4);
	while (cin>>a[0]){
	int hit_count=0;
	int blow_count=0;
	REP(i,3){
		cin>>a[i+1];
	}
	REP(i, 4){
		cin >> b[i];
	}
	REP(i, 4){
		if (a[i] == b[i]){
			hit_count++;
		}
	}
	REP(i, 4){
		REP(j, 4){
			if (i==j)continue;
			if (a[i] == b[j]){
				blow_count++;
			}
		}
	}
	cout << hit_count << " "<<blow_count<<endl;
	}
}