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

int main (){

    //data_set : a and b
    std::array<int, 4> data_a;
    std::array<int, 4> data_b;

    while(std::cin >> data_a[0] >> data_a[1] >> data_a[2] >> data_a[3]){
        std::cin >> data_b[0] >> data_b[1] >> data_b[2] >> data_b[3];
        int hit = 0;
        int blow = 0;
        for(int i = 0; i < 4; ++i){
            //if same digit and same num
            if(data_b[i] == data_a[i]) {
                hit++;
            } else {
                //if different digit and same num
                for (int j = 0; j < 4; ++j) {
                    if (data_b[i] == data_a[j]) {
                        blow++;
                    }
                }
            }
        }
        std::cout << hit << " " << blow << std::endl;

    }
}

C++: #include <iostream>
using namespace std;
int d[4];
int main (){
      while(cin>>d[0]){
            int tmp,x=0,y=0;
            for(int j=1;j<4;j++)cin>>d[j];
            for(int j=0;j<4;j++){
                  cin>>tmp;
                  if(d[j]==tmp){x++;continue;}
                  for(int k=0;k<4;k++)if(d[k]==tmp){y++;break;}
            }
            cout<<x<<' '<<y<<endl;
      }
}

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

int main(void) {
    int a[4], b[4], i, j, hit, blow;
    while (1) {
        hit = 0;
        blow = 0;
        for (i = 0; i < 4; i++) {
            cin >> a[i];
            if (cin.eof()) {
                goto END;
            }
        }
        for (i = 0; i < 4; i++) {
            cin >> b[i];
        }
        for (i = 0; i < 4; i++) {
            if (a[i] == b[i]) {
                hit++;
            }
        }
        for (i = 0; i < 4; i++) {
            for (j = 0; j < 4; j++) {
                if (i != j && a[i] == b[j]) {
                    blow++;
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
    END:
    return 0;
}

C++: #include <stdio.h>

int main(void){
  int a[50][4];
  int b[50][4];
  int i, j, k;
  int h, br;
  int num=0;

  /*
  for ( i=0; i<2; i++) {
    scanf("%d %d %d %d", &a[i][0], &a[i][1], &a[i][2], &a[i][3]);
    scanf("%d %d %d %d", &b[i][0], &b[i][1], &b[i][2], &b[i][3]);
  }*/

  while(scanf("%d %d %d %d", &a[i][0], &a[i][1], &a[i][2], &a[i][3])){
  	scanf("%d %d %d %d", &b[i][0], &b[i][1], &b[i][2], &b[i][3]);
  	num++;
  }
  
  for ( i=0; i<num; i++) {
  	for(j=0;j<4;j++) {
  	  for(k=0;k<4;k++) {
  		if ( a[i][j]==b[i][k] ) {
  		  if ( j==k ) {
  		  	h++;
  		  } else {
  		  	br++;
  		  }
  		}
  	  }
  	}
  	printf("%d %d\n",h, br);
  	br = h = 0;
  }


  return 0;
}

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

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

C++: #include <iostream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>

#define rep(i,n)	for(int i = 0;i < n;i++)
#define rep2(i,n)	for(int i = 1;i <= n;i++)
#define each(i,x)	for(auto & i : x)

using namespace std;

int main()
{
	vector<vector<int>> ary;
	while(!feof(stdin))
	{
		vector<int> vec(4);
		rep(i,4)
		{
			cin >> vec[i];
		}
		ary.push_back(vec);
	}
	int len = ary.size()/2;
	rep(i,len)
	{
		vector<int> a = ary[i*2];
		vector<int> b = ary[i*2+1];
		int hit = 0;
		rep(j,4)
		{
			if(a[j] == b[j])
				hit++;
		}
		sort(b.begin(),b.end());
		int blow = -hit;
		rep(j,4)
		{
			auto it = find(b.begin(),b.end(),a[j]);
			if(it != b.end())
			{
				blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int hit(int a[],int b[]);
int blow(int a[], int b[]);
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 hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

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

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

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

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long ull;
typedef long long ll;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

typedef pair<int ,int > P;

int a1,a2,a3,a4;
int b1,b2,b3,b4;
vector<int> a,b;

int main()
{
	while(cin>>a1>>a2>>a3>>a4>>b1>>b2>>b3>>b4)
	{
		int hit=0,blow=0;
		if(a1==b1)
			hit++;
		if(a2==b2)
			hit++;
		if(a3==b3)
			hit++;
		if(a4==b4)
			hit++;
		
		if(a1==b2||a1==b3||a1==b4)
			blow++;
		if(a2==b1||a2==b3||a2==b4)
			blow++;
		if(a3==b2||a3==b1||a3==b4)
			blow++;
		if(a4==b2||a4==b3||a4==b1)
			blow++;

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


	return 0;
}

C++: #include <iostream>
#include <array>
void counter(unsigned int* n_a,unsigned int* n_b,int* hit,int* blow);

int main() {

	std::array<unsigned int, 4> n_a;//selection of "A"
	std::array<unsigned int, 4> n_b;//selection of "B"

	while (std::cin) {
		std::cin >> n_a[0] >> n_a[1] >> n_a[2] >> n_a[3];
		std::cin >> n_b[0] >> n_b[1] >> n_b[2] >> n_b[3];

		int hit = 0;//factor and place are same
		int blow = 0;//only factor is same

		counter(n_a.data(),n_b.data(),&hit,&blow);

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

}

/*This function is a counter for "hit" and "blow".*/
void counter(unsigned int* n_a,unsigned int* n_b,int* hit,int* blow) {
	
	for (int i = 0; i < 4; ++i){
		for (int j = 0; j < 4; ++j){
			//the case of factor and place are same
			if (n_a[i] == n_b[j] && i == j) {
				*hit = *hit + 1;
			}
			//the case of only factor is same
			else if (n_a[i] == n_b[j]) {
				*blow = *blow + 1;
			}
			//otherwise
			else {
				//nothing to do
			}
		}
	}

	return;
}