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], b[4], hit, blow;

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

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

int a[4], b[4];

int main(){
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		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] && i != j) blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

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

    return 0;
}

C++: 
#include <iostream>

int main(){
    int a_num[4];
    int b_num[4];
    
    while (true) {
        
        // input a's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> a_num[i]) ){
                return 0;
            }
        }
        // input b's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> b_num[i]) ){
                return 0;
            }
        }
        
        // count hit.
        int hit=0;
        for (int i=0; i<4; ++i) {
            if (a_num[i] == b_num[i]) {
                ++hit;
            }
        }
        std::cout << hit << " ";
        
        // count blow.
        int blow=0;
        for (int i=0; i<4; ++i) {
            for (int j=0; j<4; ++j) {
                if (i==j) {
                    break;
                }
                if (b_num[i] == a_num[j]) {
                    ++blow;
                    break;
                }
            }
        }
        std::cout << blow << std::endl;
        
    }
    return 0;
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			if(b[i] == a[i])hit++;
			else if(find(a, a + 4, b[i]) - a != 4)blow++;
		}
		cout << hit << ' ' << blow << '\n';
	}
	return 0;
}

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

C++: #include <bits/stdc++.h>

using namespace std;

int main() {

    int a[4], b[4];
    int hit, blow;

    while(1) {

        hit = 0;
        blow = 0;

        for(int i = 0; i < 4; ++i) {
            if(!(cin >> a[i])) return 0;
        }

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

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

    }

    return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a[4];
	int b[4];
	while(cin >> a[0]){
		int hit = 0;
		int brow = 0;
		FOR(i,1,4){
			cin >> a[i];
		}
		rep(i,4){
			cin >> b[i];
			if(a[i] == b[i])hit++;
		}
		rep(i,4)rep(j,4){
			if(a[i] == -1 || b[j] == -1)continue;
			if(a[i] == b[j]){
				brow++;
				a[i] = -1; b[j] = -1;
			}
		}
		cout << hit << " " << (brow-hit) << endl;
	}

	return 0;
}

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

int main() {
    std::array<int, 4> a, b;

    while (std::cin >> a[0] >> a[1] >> a[2] >> a[3] 
                    >>b[0] >> b[1] >> b[2] >> b[3]) {
        int cnt_hits = 0, cnt_blows = 0;
        
        for (int i = 0; i < 4; ++i) {
            for (int j = 0; j < 4; ++j) {
                if (a[i] == b[j]) {
                    i != j ? ++cnt_blows : ++cnt_hits;
                }
            }
        }

        std::cout << cnt_hits << " " << cnt_blows << std::endl;
    }

    return 0;
}

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

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

C++: #include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int a[4],u[10],h,b,t; while(cin>>a[0]){
    rep(i,10)u[i]=0; h=0,b=0;
    rep(i,3)cin>>a[i+1]; rep(i,4)u[a[i]]=1;
    rep(i,4){
      cin>>t; if(a[i]==t)h++;
      if(u[t])b++;
    }
    cout<<h<<" "<<b-h<<endl;
  }
  return 0;
}

C++: #include <iostream>

int main(){
	std::array(u_int, 4) a, b;
	int hit=0, blow=0;

	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		cin >> 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(a[i]==b[j]) blow++;
			}
		}
		cout << hit << blow-hit << std::endl;
	}

    return 0;
}