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

int main(){
    std::array<int, 4> a; //player A
    std::array<int, 4> b; //player B
    int hit=0;
    int blow=0;
   
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        std::cin >> 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] == -1)
	//break;

	//    std::cout << b[0];
    
        for(int i=0; i<a.size(); ++i){
            for(int j=0; j<b.size(); ++j){
	        if(a[i] == b[j] && i == j)
	            ++hit;
	        else if(a[i] == b[j] && i != j)
	            ++blow;
	    }
	}

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

	hit = blow = 0;
    }  
    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]) {
		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 <iostream>
#include <string>

int main(){
    int runs =0;
    int i,j;
    int hits=0;
    int blows=0;
    int player1[4]; 
    int player2[4]; 
	while(4==scanf("%d %d %d %d", &player1[0],&player1[1],&player1[2],&player1[3])){
	    
	    scanf("%d %d %d %d", &player2[0],&player2[1],&player2[2],&player2[3]);
	    hits=0;
	    blows=0;
	    for(i=0;i<4;i++){
	        if(player1[i]==player2[i]) hits++;
	        for(j=i;j<4;j++){
	            if(player1[i]==player2[j]) blows++;
	        }
	    }
	    blows-=hits;
	    if(runs!=0) printf("\n");
	    runs++;
	    printf("%d %d",hits,blows);
	}  
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

int main() {
	vci a(4), b(4);
	bool use[10] = { 0 };
	
	while (cin>>a[0]) {
		for_(i, 1, 4) cin>>a[i];
		for_(i, 0, 4) cin>>b[i];
		memset(use, 0, sizeof(use));
		for_(i, 0, 4) use[ a[i] ] = 1;
		
		int hit = 0, blow = 0;
		for_(i, 0, 4) {
			if (a[i] == b[i]) hit++;
			else if (use[ b[i] ]) blow++;
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int hit, brow;

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

int main()
{
  int a[4], b[4];
  int i;
  
  while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    hit = brow = 0;
    for (i = 0; i < 4; i++){
      op(a, b[i], i);
    }
    
    cout << hit << " " << brow << endl;
  }
}

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

using namespace std;

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

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

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

int a[4];
int b[4];
bool used[2][4];

int main()
{
  while(cin >> a[0]){
    rep(i, 3) cin >> a[i+1];
    rep(i, 4) cin >> b[i];

    int hit = 0;
    int blow = 0;
    rep(i, 4) used[0][i] = used[1][i] = false;
    rep(i, 4) if(a[i] == b[i]) hit += 1,  used[0][i] = used[1][i] = true;
    rep(i, 4) rep(j, 4) if(a[i] == b[j] && !used[0][i] && !used[1][j]) blow += 1;

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

  return 0;
}

C++: #include <stdio.h>

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

C++: #include <iostream>

int main(int argc, const char * argv[])
{
    int a1, a2, a3, a4, b1, b2, b3, b4;
    int cnt_h, cnt_b;
    while (std::cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
        cnt_h = cnt_b = 0;
        cnt_h = (a1 == b1) + (a2 == b2) + (a3 == b3) + (a4 == b4);
        if (a1 != b1) {
            cnt_b = (a1 == b2) + (a1 == b3) + (a1 == b4);
        }
        if (a2 != b2) {
            cnt_b += (a2 == b1) + (a2 == b3) + (a2 == b4);
        }
        if (a3 != b3) {
            cnt_b += (a3 == b1) + (a3 == b2) + (a3 == b4);
        }
        if (a4 != b4) {
            cnt_b += (a4 == b1) + (a4 == b2) + (a4 == b3);
        }
        printf("%d %d\n", cnt_h, cnt_b);
    }
    return 0;
}