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 "bits/stdc++.h"
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 n1 = 0, n2 = 0;
		for (int i = 0; i < 4;i++) {
			if (a[i] == b[i])n1++;
		}
		for (int i = 0; i < 4;i++) {
			for (int j = 0; j < 4;j++) {
				if (i == j)continue;
				if (a[i] == b[j]) n2++;
			}
		}
		cout << n1 << " " << n2 << 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, 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 << "\n";
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int a[4],b[4];
  while(~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3)){
    int hit = 0;
    REP(i,4)if(a[i]==b[i])++hit;
    set<int> S;
    REP(i,4)S.insert(a[i]);
    int blow = -hit;
    REP(i,4)if(S.find(b[i])!=S.end())++blow;
    printf("%d %d\n",hit,blow);
  }
  return 0;
}

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

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

int main(){
	int Hit , Blow ;
	char a[4],b[4];
	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++) {
            for (int j = 0; j < 4; j++) {
                if (a[i] == b[j]) {
                    if (i == j) Hit++;
                    else Blow++;
                }
            }
        }

		cout << Hit << " " << Blow << "\n";
	}

}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	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;
		rep(i, 4) {
			if(a[i] == b[i]) hit++;
		}
		rep(i, 4) {
			if(find(a, a + 4, b[i]) != a + 4) blow++;
		}
		cout << hit << " " << blow - hit << 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>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int tmp;
	while( cin >> tmp ){
		int a[4],b[4];
		a[0] = tmp;
		rep(i,1,4) cin >> a[i];
		rep(i,0,4) cin >> b[i];
		map<int,bool> mp;
		rep(i,0,4) mp[a[i]] = 1;
		
		int h=0,br=0;
		rep(i,0,4){
			if( a[i] == b[i] ) h++;
			else if(mp[b[i]]) br++;
		}

		cout << h << " "<< br << endl;
	}
	ret 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
using namespace std;

int main() {
	while(true) {
		int a[10],b[10],h,bl;
		fill(a,a+10,0);
		fill(b,b+10,0);
		h=bl=0;
		int a1,a2,a3,a4,b1,b2,b3,b4;
		if(scanf("%d%d%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)<8)break;
		if(a1==b1)h++;
		if(a2==b2)h++;
		if(a3==b3)h++;
		if(a4==b4)h++;
		a[a1]++;
		a[a2]++;
		a[a3]++;
		a[a4]++;
		b[b1]++;
		b[b2]++;
		b[b3]++;
		b[b4]++;
		for(int i = 0; i < 10; i++) bl+=min(a[i],b[i]);
		printf("%d %d\n",h,bl-h);
	}
	return 0;
}

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


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


void solve(){
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 4; j++){
			if (b[i] == a[j] && i == j){
				hit++;
				break;
			}
			if (b[i] == a[j]){
				blow++;
				break;
			}
		}
	}
}


int main(){
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		solve();
		cout << hit << ' ' << blow << endl;
		hit = 0;
		blow = 0;
	}

	return 0;
}