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

int main(){
	while(1){
		int hit = 0, blow = 0;
		vector<int> a, b;
		int input;
		for(int i = 0; i < 4; i++){
			cin >> input;
			a.push_back(input);
		}
		for(int i = 0; i < 4; i++){
			cin >> input;
			b.push_back(input);
		}
		vector<int>::iterator a_ite, b_ite;
		for(a_ite = a.begin(); a_ite != a.end(); a_ite++){
			for(b_ite = b.begin();b_ite != b.end(); b_ite++){
				if(*a_ite == *b_ite) blow++;
			}
		}
		a_ite = a.begin();
		b_ite = b.begin();
		for(; a_ite != a.end(); a_ite++){
			if(*a_ite == *b_ite) hit++;
			b_ite++;
		}
		blow -= hit;

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

	return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int h=0,n=0;
	int a[3],b[3],dat=1;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
	int a[3],b[3],dat=1;
		for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	for(int k=0;k<4;k++){
		for(int o=0;o<4;o++){
			if(a[k]==b[k]){
				h++;
			}
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	}
	cout<<h<<endl;
	cout<<n<<endl;
	return 0;
}

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

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

const int data_count = 4;

bool read_dataset(std::istream& input, int* a, int* b)
{
	for (int i = 0; i < data_count; ++i) {
		input >> a[i];
	}
	for (int i = 0; i < data_count; ++i) {
		input >> b[i];
	}
	return input.good();
}

int main()
{
	int a[data_count], b[data_count];
	while (read_dataset(std::cin, a, b)) {
		int hit_count = 0;
		int blow_count = 0;
		for (int ia = 0; ia < data_count; ++ia) {
			for (int ib = 0; ib < data_count; ++ib) {
				if (a[ia] == b[ib]) {
					if (ia == ib) {
						++hit_count;
					} else {
						++blow_count;
					}
				}
			}
		}
		std::cout << hit_count << ' ' << blow_count << std::endl;
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	for (int a[4],b[4]; cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]; ) {
		int h = 0, v = 0;
		rep(i, 4) h += a[i] == b[i];
		rep(i, 4) rep(j, 4) if (i != j) v += a[i] == b[j];
		cout << h << ' ' << v << endl;
	}
	
	return 0;
}

C++: int main()
{
    int hit[4]={},blow[4]={};
    while(cin>>hit[0]){
        int ans1=0,ans2=0;
        for(int i=1; i<4; i++){
            cin>>hit[i];
        }
        for(int i=0; i<4; i++){
            cin>>blow[i];
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(hit[i]==blow[j]){
                    (i==j)?ans1++:ans2++;
                }
            }
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}

C++: #include<cstdio>
int main(){
    int a[4],b[4];
    while(~scanf("%d",&a[0])){
        bool e[10];
        for(int i=0;i<10;i++){
            e[i]=false;
        }
        int hi=0,bl=0;
        e[a[0]]=true;
        for(int i=1;i<4;i++){
            scanf("%d",&a[i]);
            e[a[i]]=true;
        }
        for(int i=0;i<4;i++){
            scanf("%d",&b[i]);
            if(a[i]==b[i]) hi++;
            else if(e[b[i]]) bl++;
        }
        printf("%d %d\n",hi,bl);
    }
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main()
{
while(true)
{
vector<int> a(4);
for(int i = 0; i < 4; i++)cin >> a[i];
int hit=0, blow=0;
for(int i = 0; i< 4; i++)
{
int b;
cin >> b;
for(int j = 0;j<4;j++)
{
if(a[j] == b)
{
if(i == j)hit++;else blow++;
}
}
}
cout << hit << " " << blow << endl;
}
return 0;
}

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

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

}

C++: #include <iostream>
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 ){
			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>
#include <algorithm>
#include <iostream>
using namespace std;

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

int main()
{
  int a[4], b[4];
  while(!cin.eof()){
    REP(i,4) cin >> a[i];
    REP(i,4) cin >> b[i];

    int hit=0, blow=0;
    REP(i,4){
      if(a[i]==b[i])
	hit++;
      else{
	REP(j,4){
	  if(a[i]==b[j])
	    blow++;
	}
      }
    }

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

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

int main(){
	int a[4],b[4],i,j,h,r;
	while( cin >> a[0] ){
		h=0;
		r=0;
		for(i=1;i<4;i++){
			cin >> a[i] ;
		}
		for(i=0;i<4;i++){
			cin >> b[i] ;
		}
		
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i] == b[j]){
					r++;
				}
			}
			if(a[i] == b[i]){
				h++;
				r--;
			}
		}
		cout << h << " " << r << "\n" ;
	}
return 0;
}