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 <cmath>
#include <vector>


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

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

C++: #include<iostream>
using namespace std;
int main(void) {
	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;
		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 <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a[4];
	int b[4];
	while(cin >> a[0]){
		int hit = 0;
		int brow = 0;
		FOR(i,1,4){
			cin >> a[i];
		}
		rep(i,4){
			cin >> b[i];
			if(a[i] == b[i])hit++;
		}
		rep(i,4)rep(j,4){
			if(a[i] != -1 || b[j] != -1)continue;
			if(a[i] == b[j]){
				brow++;
				a[i] = -1; b[j] = -1;
			}
		}
		cout << hit << " " << (brow-hit) << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a[5],b[5];
	int x;
	while(cin>>x){
		a[0]=x;
		for( int i=1 ; i<4 ; i++ )
			cin >> a[i];
		for( int i=0 ; i<4 ; i++ )
			cin >> b[i];
		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;
	}
}

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

bool input( int a[], int b[], int n ) {
	for( int i = 0; i < n; ++i ) {
		if( !(cin >> a[i]) ) { return false; }
	}

	for( int i = 0; i < n; ++i ) {
		if( !(cin >> b[i]) ) { return false; }
	}

	return true;
}

int main() {
	ios_base::sync_with_stdio( false );

	constexpr int N = 4;
	int a[N];
	int b[N];

	while( input( a, b, N ) ) {
		int hit = 0;
		int blow = 0;

		for( int i = 0; i < N; ++i ) {
			for( int j = 0; j < N; ++j ) {
				if( b[i] == a[j] ) {
					if( i == j ) {
						hit += 1;
					}
					else {
						blow += 1;
					}
				}
			}
		}

		cout << hit << ' ' << blow << '\n';
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int a[5],b[5],hit=0,brow=0;
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
    hit=0,brow=0;
    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(a[i]==b[i]){
                hit++;
                break;
            }
            else if(a[i]==b[j])brow++;
        }
    }
    cout<<hit<<" "<<brow<<endl;
    }
return 0;
}

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

int main(void){
  vector<int> a(4);
  vector<int> b(4);

  while(cin>>a[0]){
    int va[10] = {0};
    int vb[10] = {0};
    va[--a[0]]++;
    for(int i = 1 ; i < 4 ; i ++){
      cin>>a[i];
      va[--a[i]]++;
    }
    int hit = 0;
    for(int i = 0 ; i < 4 ; i ++){
      cin>>b[i];
      if(a[i] + 1 == b[i]){
	hit++;
      }
      vb[--b[i]]++;
    }
    int blow = 0;
    for(int i = 0 ; i < 10 ; i ++){
      blow += min(va[i],vb[i]);
    }
    cout<<hit<<" "<<blow-hit<<endl;
  }
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(void){
    int x[4]={},y[4]={};
    while(cin>>x[0]>>x[1]>>x[2]>>x[3]>>y[0]>>y[1]>>y[2]>>y[3]){
        int h=0,b=0;
        for(int i=0;i<4;i++){
           for(int j=0;j<4;j++){
               if(x[i]==y[j]){
                   if(i==j) h++;
                   else b++;
               }
           }
        }
        cout << h << " " << b << endl; 
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>

using  namespace std;

int main(){
	int a[4];
	int b[4];
	int hit, blow;


	while (cin >> a[0]){
		cin >> a[1];
		cin >> a[2];
		cin >> a[3];
		cin >> b[0];
		cin >> b[1];
		cin >> b[2];
		cin >> 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] && i == j){
					hit++;
				}
				if (a[i] == b[j] && i != j){
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;

	}

}

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

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 50;
    for(int i = 0;i < 50;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] 
            >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i] ;
        /*int t = 0;
        for(int j = 0;j < 4;j++){
            if(a[j][i] != 0){
                t = 1;
                j = 4;
            }
            if(b[j][i] != 0){
                t = 1;
                j = 4;
            }
        }
        if (t == 0){
            n = i;
            i = 50;
        }*/
    } 
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

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