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<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int a[4],b[4];
   int hit,blow;
   while(cin>>a[0])
   {
     hit=blow=0;
     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 i=0;i<4;i++)
     {
       for(int j=i+1;j<4;j++)
       {
         if(a[i]==b[j]) blow++;        
       }        
     }
     cout<<hit<<" "<<blow<<endl;
   }
   //while(1);      
   return 0;    
 }

C++: #include <cstdio>

using namespace std;

int hit = 0, blow = 0,a[4], b[4];

int main()
{
    for( int i = 0; i < 4; i++ )
    {
        scanf( "%d ", &a[i] );
    }
    for( int i = 0; i < 4; i++ )
    {
        scanf( "%d ", &b[i] );
    }

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

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, blow=0;
        rep(i,4) {
            if(a[i]==b[i]) hit++;
            else {
                rep(j,4) if(a[i]==b[j]) blow++;
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

int main()
{
	int i,j;
	int a[4];
	int b[4];
	while(cin >> a[0]){

		int hit =  0;
		int blow = 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(b[i] == a[j]){
					(j == i) ? ++hit : ++blow;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

C++: // 0025 Hit and Blow
#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;

	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; 
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

void solve(int a[], int b[], int ret[]){
	// ret[0] = ヒット数, ret[1] = ブロー数
	for (int i = 0; i < 4; i++){
		if (a[i] == b[i])	ret[0]++;
		else{
			for (int j = 0; j < 4; j++){
				if (b[i] == a[j])
					ret[1]++;
			}
		}
	}
}

int main(){
	int a[4], b[4];
	int ret[2] = {};

	while (cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()){
		for (int i = 0; i < 4; i++)	cin >> b[i];
		ret[0] = 0; ret[1] = 0;
		solve(a, b, ret);
		cout << ret[0] << " " << ret[1] << endl;
	}
	return 0;
}

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

int main() {
	int a[4];
	int b[4];
	bool flag[4];
	for(int i = 0; i < 4; i++) flag[i] = false;
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		int hitNumber = 0;
		int blowNumber = 0;
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				hitNumber++;
				flag[i] = true;
			}
		}
		for(int i = 0; i < 4; i++) {
			if(flag[i] == true) continue;
			else {
				for(int j = 0; j < 4; j++) {
					if(a[i] == b[j]) {
						blowNumber++;
					}
				}
			}
		}
		cout << hitNumber << " " << blowNumber << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	vector<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 < a.size(); ++i)
			if (a[i] == b[i]) hit++;

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

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

	return 0;
}