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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

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

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

int main()
{

	int a[4]={},b[4]={};


	while(cin	>>a[0] >> a[1] >> a[2] >> a[3]
					>>b[0] >> b[1] >> b[2] >> b[3]){

		if(!a[0] & !a[1] & !a[2] &!a[3] & !b[0] & !b[1] & !b[2] &!b[3])
			break;

		int hit = 0,blow = 0;

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

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

		blow -= hit;	
		cout << hit << " " << blow << endl;
		
		for(int i=0;i<4;++i){
			a[i] = 0;
			b[i] = 0;
		}

	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int blow,hit;
	int a[4];
	int b[4];
while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3])
{	
	hit=0;
	blow=0;
	for(int i=0;i<4;i++)
	{
		if(a[i]==b[i])
		{
			hit++;
		}
		for(int j=i+1;j<4;j++)
		{
			if(a[j]==b[i])
			{
			blow++;
			}
		}
	}
	cout<<hit<<" "<<blow<<endl;
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    while (true)
    {
        int a[4], b[4];
        rep(j, 4) cin >> a[j];
        rep(j, 4) cin >> b[j];
        int hit = 0, bl = 0;
        rep(i, 4)
        {
            rep(j, 4)
            {
                if (a[i] == b[j])
                {
                    if (i == j)
                        hit++;
                    else
                        bl++;
                }
            }
        }
        cout << hit << ' ' << bl << endl;
                        if (cin.eof())
            break;
    }
    return 0;
}

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

int a[4],b[4];
int main(){
  int i,j,h,l;
  for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l)){
    for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;
  }
}

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>

using namespace std;

string my_string(int i){
	stringstream ss;
	ss << i;
	string str = ss.str();
	return str;
}

string HitBlow(vector<int> A, vector<int> B){
	int hit = 0, blow = 0;
	for(int i = 0; i< 4; i++)
		if(A[i] == B[i]){
			B[i] = -1;
			hit++;
		}
	for(int i = 0; i< 4; i++){
		if(B[i] == -1) continue;
		for(int j = 0; j< 4; j++){
			if(A[j] == B[i]){
				blow++;
			}
		}
	}
	string rtn = my_string(hit)+" "+my_string(blow)+"\n";
	cout<<rtn;
	return rtn;
}

int main(){
	vector< vector<int> > inputA, inputB;
	bool isA = true;
	string line;
	ofstream outfile("outfile.txt");
	ifstream input_file("test_input.txt");
	if(input_file.is_open()){
		while(getline(input_file, line)){
			vector<int> tmp;
			for(int i = 0; i< line.length(); i++){
				if(line[i] == ' ') continue;
				tmp.push_back(int(line[i]-'0'));
			}
			if(isA)
				inputA.push_back(tmp);
			else
				inputB.push_back(tmp);
			isA = !isA;
		}
	}
	string ss;
	for(int i = 0; i< inputA.size(); i++){
		ss = HitBlow(inputA[i], inputB[i]);
		if(outfile.is_open())
			outfile<<ss;
	}
	return 0;
}

C++: //#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    vi a(4);
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
        vi b(4);
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hit=0, brow=0;
        rep(i,4) if(a[i]==b[i]) hit++;
        rep(i,4) {
            REP(j,i+1,4) if(a[i]==b[j]) brow++;
        }
        printf("%d %d\n",hit,brow);
    }
    return 0;
}

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

int main(){

	std::array<int,4> num_a, num;

	std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3];

	while(std::cin >> num[0] >> num[1] >> num[2] >> num[3]){
		int hit = 0, blow = 0;
		for(size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++blow;
					}
				}
			}
		}
		std::out << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
using namespace std;
int main(){
  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,brow=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]){
	  brow++;
	}
      }
    }
    cout<<hit<<" "<<brow-hit<<endl;
  }
  return 0;   
}