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++: //#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    vi a(4);
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
        vi b(4);
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hit=0, brow=0;
        rep(i,4) if(a[i]==b[i]) hit++;
        rep(i,4) {
            REP(j,i+1,4) if(a[i]==b[j]) brow++;
        }
        printf("%d %d\n",hit,brow);
    }
    return 0;
}

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

int main(){

	std::array<int,4> num_a, num;

	std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3];

	while(std::cin >> num[0] >> num[1] >> num[2] >> num[3]){
		int hit = 0, blow = 0;
		for(size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++blow;
					}
				}
			}
		}
		std::out << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
using namespace std;
int main(){
  int a[4],b[4];
  while(cin>>a[0]){
    for(int i=1;i<4;i++){
      cin>>a[i];
    }
    for(int i=0;i<4;i++){
      cin>>b[i];
    }
    int hit=0,brow=0;
    for(int i=0;i<4;i++){
      if(a[i]==b[i]){
	hit++;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(a[i]==b[j]){
	  brow++;
	}
      }
    }
    cout<<hit<<" "<<brow-hit<<endl;
  }
  return 0;   
}

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(1){
		
		h=0;
		br=0;
		
		for(int i=0;i<4;i++) cin >> a[i];
		for(int j=0;j<4;j++) cin >> b[j];
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		cout << h << ' '<< br << endl;
	}
}

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

C++: // 0025 Hit and Blow
#include <iostream>
using namespace std;

int main()
{
	int a[3]; // 正解の数字
	int b[3]; // 回答者の数字
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ // 正解の数字を入力
	  int hit  =0; // 初期値
	  int blow =0; // 初期値

	for(int i=0; i<4; i++) // 回答者の数字を入力
		cin >> b[i];

	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 <iostream>

using namespace std;

int main(){

	int A[5];
	int B[5];

	//while(1){

		int hit = 0 , blow = 0;

		cin >> A[0];

	//	if(A[0] == 0) break;

		for(int i = 1; i < 4; i++){
			cin >> A[i];
		}

		for(int i = 0; i < 4; i++){
			cin >> B[i];
		}

		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] && A[i] != B[i]){
					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] ) {
		
		int hit_cnt = 0;
		int blow_cnt = 0;
		
		for (int i=0; i<4; i++) {
			if (a[i] == b[i]) { hit_cnt++; a[i] = b[i] = -1; }
		}
		
		for (int i=0; i<4; i++) {
			if (a[i] == -1) continue;
			for (int j=0; j<4; j++) {
				if (a[i] == b[j]) { blow_cnt++; a[i] = b[j] = -1; break; }
			}
		}
		
		cout << hit_cnt << " " << blow_cnt << endl;
	}	
		
	return 0;
}