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>
using namespace std;

int a[4],b[4];
void search()
{
	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])
				blow++;
		}
	}
	cout << hit << ' ' << blow << endl;
}

int main()
{
	while(cin >> a[0]){
		for(int i=1;i<4;i++){
			cin >> a[i];
		}
		for(int i=0;i<4;i++){
			cin >> b[i];
		}
		search();
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	int a[4];
	int b[4];
	
	while( cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		cin >> 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<stdio.h>

int main(void){

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

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


int main() {
	int a[4];
	int b[4];

	while (cin >> a[0] >>a[1] >>a[2]>>a[3]) 
	{
		int hit = 0;
		int blow = 0;
		cin >> b[0]>>b[1]>>b[2]>>b[3] ;
		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 <stdio.h>

bool d[12];

int a[4];
int b[4];

int main()
{
while(0 != scanf("%d",a))
{
for(int i = 1; i < 4; i++)
{
scanf("%d",a + i);
}
for(int i = 0; i < 4; i++)
{
scanf("%d",b + i);
}
for(auto& i : d)
{
i = false;
}
for(auto i : a)
{
d[i] = true;
}
int hi = 0;
int bu = 0;
for(int i = 0; i < 4; i++)
{
if(a[i] == b[i])
{
hi++;
}
else if(d[b[i]])
{
bu++;
}
}
}
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)


int a[4],b[4];

int main(){
	
	
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		int hit=0,blo=0;
		rep(i,4){
			if(a[i]==b[i]){
				a[i] = -1;
				b[i] = -2;
				hit++;
			}
		}
		rep(i,4){
			rep(j,4){
				if(a[i] == b[j]){
					a[i]=-1;
					b[j]=-2;
					blo++;
				}
			}
		}
		cout<<hit<<" "<<blo<<endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
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, blow=0;
    bool checked[4][4]; for(int i=0;i<4;i++)for(int j=0;j<4;j++)checked[i][j]=false;
    
    for(int i = 0; i < 4; i++) {
      for(int j = i; j < 4; j++) {
	if(checked[i][j]) continue;
	
	if(i == j && a[i] == b[j]) {
	  hit++;
	  checked[i][j] = true; checked[j][i] = true;
	}
	else if(a[i] == b[j]) {
	  blow++;
	  checked[i][j] = true; checked[j][i] = true;
	}
      }
    }

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

C++: #include<iostream>
#include<fstream>
#include<vector>
#include<string>

using namespace std;

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 = to_string(hit)+" "+to_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>
using namespace std;

int main(){
  int A[4];
  int B[4];
  while(cin >> A[0] >> A[1] >> A[2] >> A[3]){
    cin >> B[0] >> B[1] >> B[2] >> B[3];
    
    int hit = 0;
    int blow = 0;
    for(int i=0;i<4;i++){
      if(A[i] == B[i]) hit++;

      for(int j=0;j<4;j++){
        if(j==i) continue;
        else if(B[i] == A[j]) blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    while (1) {
        int a[4], b[4], 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];
            if (a[i] == b[i]) {
                hit++;
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (i == j) {
                    continue;
                }
                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],count,count_2;

	while(cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		count = 0;
		count_2 = 0;

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