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<iostream>
#include<cstdio>
using namespace std;

int main() 
{
  int a[4];
  int b[4];
  int brow, hit;
  while(cin>> a[0] >> a[1] >> a[2] >>a[3] >> b[0] >> b[1] >> b[2] >> b[3])
  {
    hit = brow = 0;
    for(int i = 0; i < 4; i++)
    {
      for(int j = 0; j < 4; j++)
      {
        if(a[i] == b[j])
        {
          brow++;
          break;
        }
      }
    }
    for(int i = 0; i < 4; i++)
    {
      if(a[i] == b[i])
      {
        hit++;
      }
    }
    cout << hit << " " << brow - hit << endl;
  }
  return 0;
}

C++: #include <stdio.h>

int
main(void)
{
	char line[80];
	int a[4], b[4];

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d %d %d %d", &(a[0]), &(a[1]), &(a[2]), &(a[3])) != 4) {
			return 1;
		}

		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%d %d %d %d", &(b[0]), &(b[1]), &(b[2]), &(b[3])) != 4) {
			return 1;
		}
		
		int h = 0;
		int w = 0;
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) {
						h++;
					} else {
						w++;
					}
				}
			}
		}
		printf("%d %d\n", h, w);
	}

	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 <cstdio>
using namespace std;

int main()
{
    int ans_a[100],ans_b[100];
    int hit=0,brow=0;
    
    cin>>ans_a[0]>>ans_a[1]>>ans_a[2]>>ans_a[3]>>ans_b[0]>>ans_b[1]>>ans_b[2]>>ans_b[3];
        for (int i=0; i<4; i++) {
            for (int j=0; j<4; j++) {
                if (ans_a[i]==ans_b[j]&&i==j) {
                    hit++;
                }
                else if(ans_a[i]==ans_b[j]) {
                    brow++;
                }
            }
        }
        printf("%d %d",hit,brow);
        puts("");
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>
 
#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)
 
int main(){
	int a[4], b[4];
	while(1){
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			if(!(cin >> a[i])){
				return 0;
			}
		}
		for(int i = 0; i < 4; i++){
			if(!(cin >> b[i])){
				return 0;
			}
		}

		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++;
				}
			}
		}
		blow -= hit;

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

	return 0;
}

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

int main() {
	vector<int> a(4), b(4);
   
	while(true){
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) cin >> b[i];

if(cin.eof()) break;
		
		int hit = 0, blow = 0;
		for( int i=0; i<4; ++i ){
			for( int j=0; j<4; ++j ){
				if( a[i] == b[j] ){
					( i==j ? hit : blow ) += 1;	
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

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

int main(){
  int a[4],b[4],hit,blow,i;
	while(cin>>a[0]){
		hit=0,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(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()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    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++){
            if(a[i]==b[i]){
                ++hit;
                continue;
            }
            for(int j=0; j<4; j++){
                if(i!=j&&b[i]==a[j]){
                    ++blow;
                    break;
                }

            }
        }
        cout<<hit<<' '<<blow<<'\n';
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

int main() {
	vci a(4), b(4);
	bool use[10] = { 0 };
	
	while (scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3])!=EOF) {		
		for_(i, 0, 4) use[ a[i] ] = 1;
		
		int hit = 0, blow = 0;
		for_(i, 0, 4) {
			if (a[i] == b[i]) hit++;
			else if (use[ b[i] ]) blow++;
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(void){
	int a[4],b[4];
	int i,l;
	int ans[2]={0};	//hit blou
	while(scanf("%d",a)!=EOF){
		for(i=1;i<4;i++)
			scanf("%d",&a[i]);
			
		for(i=0;i<4;i++){
			scanf("%d",&b[i]);
			for(l=0; l<4; l++){
				if(a[l]==b[i])
					ans[1]++;
			}
			if(a[i]==b[i]){
			ans[1]--;
			ans[0]++;
			}
		}
		
		printf("%d %d\n",ans[0],ans[1]);
		ans[0]=0;
		ans[1]=0;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define int long long
signed main(){
	int a1,b1,c1,d1;
	int a2,b2,c2,d2;
	while( scanf("%lld %lld %lld %lld", &a1, &b1, &c1, &d1) != EOF ){
		scanf("%lld %lld %lld %lld", &a2, &b2, &c2, &d2);
		vector<int> listn(10,0);
		listn[a1] = 1;
		listn[b1] = 1;
		listn[c1] = 1;
		listn[d1] = 1;
		int hit=0, blow=0;
		if (a1==a2) hit++;
		else blow += listn[a2];
		if (b1==b2) hit++;
		else blow += listn[b2];
		if (c1==c2) hit++;
		else blow += listn[c2];
		if (d1==d2) hit++;
		else blow += listn[d2];
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){

  int a[4],b[4],n,m;

  while(cin >> a[0]){
    n = 0;
    m = 0;
    cin >> a[1] >> a[2] >> a[3];
    for(int i=0;i<4;i++){
      cin >> b[i];
      if(a[i] == b[i]) n++;
      for(int j=0;j<4;j++){
	if(b[i] == a[j]) m++;
      }
    }
    
    cout << n << " " << (m-n) << endl;
  }
  return (0);
}