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<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow,x,z;
	double stoped;
	
	
	while(scanf("%lf",&j)!=EOF){
		
		x=0,z=0;
		hit=0,brrow=0;
	
		for(i=0;i<4;i++){
			scanf("%d",&x);
			a[i]=x;
		}

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

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

C++: #include<iostream>

using namespace std;

int main(void) {
  int A[4];
  int B[4];
  int blow;
  int hit;

  while(!cin.eof()) {
    blow = 0;
    hit = 0;


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

  return 0;
}

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

int main() {
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (cin >> a1) {
		cin >> a2 >> a3 >> a4;
		cin >> b1 >> b2 >> b3 >> b4;
		
		vector<int> a(4), b(4);
		a.at(0) = a1;
		a.at(1) = a2;
		a.at(2) = a3;
		a.at(3) = a4;
		b.at(0) = b1;
		b.at(1) = b2;
		b.at(2) = b3;
		b.at(3) = b4;
		
		int hit = 0, blow = 0;
		for (int i = 0; i < 4; i++) {
			int n = b.at(i);
			int cnt = count(a.begin(), a.end(), n);

			if (cnt == 1) {
				if (a.at(i) == n) {
					hit++;
				}
				else {
					blow++;
				}
			}
		}

		cout << hit << ' ' << blow << endl;
	}
}

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 k=0,n=0;
		for (int kk=0;kk<=3;kk++){
			if(a[kk]==b[kk]){
				k=k+1;
			}
		}
		for(int l=0;l<=3;l++){
			for(int m=0;m<=3;m++){
				if(a[l]==b[m]){
					n=n+1;
				}
		}}
		cout<<k<<" "<<n-k<<endl;
	}
	return 0;
}

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

int main(){
    int a[4];
    int b[4];

    int hit;
    int blow;

    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++;
                }
            }
        }
        printf("%d %d\n", hit, blow);
    }

    return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
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;
		int 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<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x=0,y=0;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h){
        x=0;
        y=0;
        if (a==e){x=x+1} 
        if (b==f){x=x+1} 
        if (c==g){x=x+1}
        if (d==h){x=x+1}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " << y << endl;
    }  
return 0 ;
}

C++: #include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a[4], b;

signed main() {
	while (cin>>a[0]>>a[1]>>a[2]>>a[3]) {
		int x = 0, y = 0;
		rep(i,4) {
			cin >> b;
			rep(j,4) if (a[j]==b) (i==j ? x : y)++;
		}
		cout << x << ' ' << y << endl;
	}
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>

using namespace std;

double sq(double x){return x*x;}


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,brow = 0;
		for (int i = 0; i < 4; i++)
		{
			if(a[i] == b[i])
				hit++;
			else if(find(a,a+4,b[i]) != a+4)
				brow++;
		}

		printf("%d %d\n",hit,brow);
	}

	return 0;
}

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

int hit(char str[],char str2[]){
  int i, j = 0;

  for(i = 0;i < 4;i++){
    if(str[i] == str2[i]){
      j++;
    }
  }

  return j;
}

int blow(char str3[],char str4[]){
  int i, j = 0;
  char str5[2] = "";

  for(i = 0;i < 4;i++){
    strcpy(str5, "");
    strncat(str5, str4+i, 1);
    if(strstr(str3,str5) != NULL){
      j++;
    }
  }

  return j;
}

int main(){
  char str[5], str2[5];

  while(scanf("%c %c %c %c", &str[0], &str[1], &str[2], &str[3]) != EOF){ 

    cin >> str2[0] >> str2[1] >> str2[2] >> str2[3];

  int hit_var = hit(str, str2);
  int blow_var = blow(str, str2);

  cout << hit_var << " " << blow_var - hit_var << endl;

  }

  return 0;
}