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() {
	int a[4];
	int b[4];
	bool flag[4];
	for(int i = 0; i < 4; i++) flag[i] = false;
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		int hitNumber = 0;
		int blowNumber = 0;
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				hitNumber++;
				flag[i] = true;
			}
		}
		for(int i = 0; i < 4; i++) {
			if(flag[i] == true) continue;
			else {
				for(int j = 0; j < 4; j++) {
					if(a[i] == b[j]) {
						blowNumber++;
					}
				}
			}
		}
		cout << hitNumber << " " << blowNumber << endl;
	}
	return 0;
}

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

		for (int i = 0; i < a.size(); ++i)
			for (int j = 0; j < b.size(); ++j)
				if (a[i] == b[j]) blow++;

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

	return 0;
}

C++: #include <iostream>

#define N 8

using namespace std;

int main(void)
{
  int num[N];
  while(true)
  {
    for(int i = 0; i < N; i++)
    {
      if(!(cin >> num[i])) goto END;
    }
    int hit = 0, blow = 0;
    for(int i = 0; i < 4; i++)
    {
      if(num[i] == num[i+4]) hit++;
      else if(   num[i] == num[4]
	      || num[i] == num[5]
	      || num[i] == num[6]
	      || num[i] == num[7])
	blow++;
    }
    cout << hit << " " << blow << endl;
  }

 END:
  return 0;
}

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";
	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++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

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

int main(void) {
    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 = 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;
    }
}