Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <bitset>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<long long int,long long int> 
#define ff first
#define pb push_back
#define ss second
#define ll long long 
#define ull unsigned long long
#define vi vector<long long int>
#define vii vector<pii>
#define vvi vector <vi>
#define rep(x,a,b,c) for(int x=a;x<=b;x+=c)
#define repp(x,a,b) rep(x,a,b,1)
#define rev(x,a,b,c) for(int x=a;x>=b;x-=c)
#define revv(x,a,b) rev(x,a,b,1)
#define OO (int)2e9
#define INF (ll)1e18
 
using namespace std;

int a[5],b[5];
int hit,blow;

int main()
{
	while(scanf("%d %d %d %d",&a[1],&a[2],&a[3],&a[4])!=EOF)
	{
		hit=0;
		blow=0;
		scanf("%d %d %d %d",&b[1],&b[2],&b[3],&b[4]);
		repp(x,1,4)
		{
			repp(y,1,4)
			{
				if(b[x]==a[y])
				{
					if(x==y)hit++;
					else
					blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	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]) {
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    int hit=0, blow=0;
    bool checked[4][4]; for(int i=0;i<4;i++)for(int j=0;j<4;j++)checked[i][j]=false;
    
    for(int i = 0; i < 4; i++) {
      for(int j = i; j < 4; j++) {
	if(checked[i][j]) continue;
	
	if(i == j && a[i] == b[j]) {
	  hit++;
	  checked[i][j] = true; checked[j][i] = true;
	}
	else if(a[i] == b[j]) {
	  blow++;
	  checked[i][j] = true; checked[j][i] = true;
	}
      }
    }

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

C++: #include <iostream>

using namespace std;

void solve()
{
	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;
		int Blow = 0;
		for(int i = 0; i < 4; ++i)
		{
			for(int j = 0; j < 4; ++j)
			{
				if(a[i] == b[j] && i == j)
				{
					++Hit;
				}
				else if(a[i] == b[j])
				{
					++Blow;
				}
			}
		}
		cout << Hit << " " << Blow << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
	std::array(u_int, 4) a;
	std::array(u_int, 4) b;
	int hit=0, blow=0;

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

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a[4];
	int b[4];
	while(cin>>a[0]){
		rep(i,3)cin>>a[i+1];
		rep(i,4)cin>>b[i];
		int h=0,br=0;
		rep(i,4)rep(j,4)if(a[i]==b[j]){
			if(i==j)h++;
			else br++;
		}
		cout<<h<<" "<<br<<endl;
	}
}

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

int main(){
  int a[4],b[4],i,j,hit=0,blow=0;



  for(i=0;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] && i != j)blow++;
      if(a[i] == b[j] && i == j)hit++;
    }
  }

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



}

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

int main() {
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
		int hit = 0, blow = 0;
			if (a1 == b1)hit++;if (a2 == b2)hit++;
			if (a3 == b3)hit++;if (a4 == b4)hit++;
			if (a1 == b2 || a1 == b3 || a1 == b4)blow++;
			if (a2 == b1 || a2 == b3 || a2 == b4)blow++;
			if (a3 == b1 || a3 == b2 || a3 == b4)blow++;
			if (a4 == b1 || a4 == b2 || a4 == b3)blow++;
			cout << hit << " " << blow << endl;
	}
	return 0;
}

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";
	}

}