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<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 1000000000
#define EPS 1.0e-10

using namespace std;

typedef long long ll;

int a[5];
int b[5];

int main()
{
	while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
		for (int i = 0; i < 4; i++) {
			cin >> b[i];
		}
		int hit = 0;
		int 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>
#include <vector>
#include <algorithm>
 
int main(){
    std::vector<int> a(4);
     
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
         
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
             
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
				++hit;
			}
            else if(it != a.end()){
				++blow;
			}
        }
        std::cout << hit << " " << blow << std::endl;
    }
    
    return 0;
}

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

int main()
{
	std::vector<int> list_a{};
	std::vector<int> list_b{};
	std::array<bool, 10> a;
	
	int a1, a2, a3, a4;
	int b1, b2, b3, b4;
	int hit = 0, brow = 0;
	while (std::cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4)
	{
		hit = 0;
		brow = 0;
		for (auto& val : a)
		{
			val = false;
		}
		list_a.clear();
		list_b.clear();

		a[a1 - 1] = true;
		a[a2 - 1] = true;
		a[a3 - 1] = true;
		a[a4 - 1] = true;

		list_a.push_back(a1);
		list_a.push_back(a2);
		list_a.push_back(a3);
		list_a.push_back(a4);

		list_b.push_back(b1);
		list_b.push_back(b2);
		list_b.push_back(b3);
		list_b.push_back(b4);

		for (int i = 0; i < list_a.size(); ++i )
		{
			if (list_a[i] == list_b[i])
			{
				hit++;
			}
			else
			{
				if ( a[ list_b[i] - 1 ] )
				{
					brow++;
				}
			}
		}
		std::cout << hit << " " << brow << std::endl;
	}

	return 0;
}

C++: import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = null;

		try {

			sc = new Scanner(System.in);
			int countHit=0;
			int countBlow=0;

			while (sc.hasNext()) {
				

				String[] a = sc.nextLine().split(" ");
				String[] b = sc.nextLine().split(" ");

				for (int i = 0; i < a.length; i++) {
					for(int j =0; j<b.length;j++){

						if (a[i] .equals(b[i])) {
							countHit++;
							break;
						}
						else if(a[i].equals(b[j])){

							countBlow++;
						}
					}
				}

				System.out.println(countHit+" "+countBlow);

			}

		} finally {
			sc.close();
		}

	}

}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

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

		if(!a[0] & !a[1] & !a[2] &!a[3] & !b[0] & !b[1] & !b[2] &!b[3])
			break;

		int hit = 0,blow = 0;

		for(int i=0;i<4;++i){
			for(int j=i;j<4;++j){
				if(a[i] == b[j])
					++blow;
			}
		}

		for(int i=0;i<4;++i){
			if(a[i] == b[i])
				++hit;
		}

		blow -= hit;	
		cout << hit << " " << blow << endl;
		
		for(int i=0;i<4;++i){
			a[i] = 0;
			b[i] = 0;
		}

	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int blow,hit;
	int a[4];
	int b[4];
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++)
	{
		if(a[i]==b[i])
		{
			hit++;
		}
		for(int j=i+1;j<4;j++)
		{
			if(a[j]==b[i])
			{
			blow++;
			}
		}
	}
	cout<<hit<<" "<<blow<<endl;
}
return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    while (true)
    {
        int a[4], b[4];
        rep(j, 4) cin >> a[j];
        rep(j, 4) cin >> b[j];
        int hit = 0, bl = 0;
        rep(i, 4)
        {
            rep(j, 4)
            {
                if (a[i] == b[j])
                {
                    if (i == j)
                        hit++;
                    else
                        bl++;
                }
            }
        }
        cout << hit << ' ' << bl << endl;
                        if (cin.eof())
            break;
    }
    return 0;
}

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

int a[4],b[4];
int main(){
  int i,j,h,l;
  for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l)){
    for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;
  }
}

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";
	cout<<rtn;
	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;
}