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>
using namespace std;

int main(void){
    int a[4];
    int b[4];
    
    while(1){
        int hitcount = 0;
        int bcount   = 0;
        
        for(int i = 0; i < 4; i++){
            if(!(cin >> a[i])) break; 
        }
        
        for(int i = 0; i < 4; i++)
            cin >> b[i];
        
        //a???????????????????????????????´????b????????¢??¢?´¢
        for(int i = 0; i < 4; i++){
            int x = a[i];
            for(int j = 0; j < 4; j++){
                if(x == b[j]){
                    if(i == j) hitcount++;
                    else bcount++;
                }
            }
        }
        
        cout << hitcount << " " << bcount << endl;
    }
    
    return 0;
}

C++: #include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int a[4], b[4];
    while(cin >> a[0]){
        REP(i, 1, 4){
            cin >> a[i];
        }
        rep(i, 4){
            cin >> b[i];
        }

        int hi = 0, bl = 0;
        rep(i, 4){
            if(a[i] == b[i]){
                ++hi;
            }else{
                rep(j, 4){
                    if(i == j){
                        continue;
                    }
                    if(a[j] == b[i]){
                        ++bl;
                    }
                }
            }
        }

        cout << hi << " " << bl << endl;
    }

    cout << flush;

    return 0;
}

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


using namespace std;

int main(){
  vector<int> a(4,0), b(4,0);
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }
    cout << hit << " " << blow << endl;
  }
}

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

using namespace std;

int main()
{
	vector<int> a(4), b(4);

	while (cin >> a[0] >> a[1] >> a[2] >> a[3],
		cin >> b[0] >> b[1] >> b[2] >> b[3])
	{
		int hit = 0, blow = 0;

		for (int i = 0; i < a.size(); ++i)
			for (int j = 0; j < b.size(); ++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,b,c,d,e,f,g,h,x,y;
    cin >> a >> b >> c >> d;
    cin >> e >> f >> g >> h;
        if (a==e){x=x+1 ;e=e+10;} 
        if (b==f){x=x+1;f=f+10;} 
        if (c==g){x=x+1;g=g+10;}
        if (d==h){x=x+1;h=h+10;}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " <<  y << endl;
    
    
return 0 ;
}

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

int a[4],b[4];
void search()
{
	int hit=0,blow=0;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(a[i] == b[j] && i==j)
				hit++;
			else if(a[i]==b[j])
				blow++;
		}
	}
	cout << hit << ' ' << blow << endl;
}

int main()
{
	while(cin >> a[0]){
		for(int i=1;i<4;i++){
			cin >> a[i];
		}
		for(int i=0;i<4;i++){
			cin >> b[i];
		}
		search();
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

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

C++: #include<stdio.h>

int main(void){

	int a[5],b[5],i,j,hit=0,blow=0;
	
	while(scanf("%d%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
	
	for(i=0;i<4;i++){
		if(a[i]==b[i])hit++;
		
		for(j=0;j<4;j++){
			if(a[i]==b[j] &&a[i]!=b[i])blow++;
		}
	}
	
	printf("%d %d\n",hit,blow);
		hit=0;
		blow=0;
	}
return 0;
}

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


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

	while (cin >> a[0] >>a[1] >>a[2]>>a[3]) 
	{
		int hit = 0;
		int blow = 0;
		cin >> b[0]>>b[1]>>b[2]>>b[3] ;
		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 <stdio.h>

bool d[12];

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

int main()
{
while(0 != scanf("%d",a))
{
for(int i = 1; i < 4; i++)
{
scanf("%d",a + i);
}
for(int i = 0; i < 4; i++)
{
scanf("%d",b + i);
}
for(auto& i : d)
{
i = false;
}
for(auto i : a)
{
d[i] = true;
}
int hi = 0;
int bu = 0;
for(int i = 0; i < 4; i++)
{
if(a[i] == b[i])
{
hi++;
}
else if(d[b[i]])
{
bu++;
}
}
}
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)


int a[4],b[4];

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