Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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