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 <vector>
#include <algorithm>
 
using namespace std;
 
int main(){
 
    int a[4];
    int b[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
        for(int i = 0; i < 4; i++)
            cin>>b[i];
         
        int hit=0;
        int blow=0;
        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 <iostream>
#include <cmath>
#include <vector>

const int data_count = 4;

bool read_dataset(std::istream& input, int* a, int* b)
{
	for (int i = 0; i < data_count; ++i) {
		input >> a[i];
	}
	for (int i = 0; i < data_count; ++i) {
		input >> b[i];
	}
	return input.good();
}

int main()
{
	int a[data_count], b[data_count];
	while (read_dataset(std::cin, a, b)) {
		int hit_count = 0;
		int blow_count = 0;
		for (int ia = 0; ia < data_count; ++ia) {
			for (int ib = 0; ib < data_count; ++ib) {
				if (a[ia] == b[ib]) {
					if (ia == ib) {
						++hit_count;
					} else {
						++blow_count;
					}
				}
			}
		}
		std::cout << hit_count << ' ' << blow_count << std::endl;
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	for (int a[4],b[4]; cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]; ) {
		int h = 0, v = 0;
		rep(i, 4) h += a[i] == b[i];
		rep(i, 4) rep(j, 4) if (i != j) v += a[i] == b[j];
		cout << h << ' ' << v << endl;
	}
	
	return 0;
}

C++: int main()
{
    int hit[4]={},blow[4]={};
    while(cin>>hit[0]){
        int ans1=0,ans2=0;
        for(int i=1; i<4; i++){
            cin>>hit[i];
        }
        for(int i=0; i<4; i++){
            cin>>blow[i];
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(hit[i]==blow[j]){
                    (i==j)?ans1++:ans2++;
                }
            }
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}

C++: #include<cstdio>
int main(){
    int a[4],b[4];
    while(~scanf("%d",&a[0])){
        bool e[10];
        for(int i=0;i<10;i++){
            e[i]=false;
        }
        int hi=0,bl=0;
        e[a[0]]=true;
        for(int i=1;i<4;i++){
            scanf("%d",&a[i]);
            e[a[i]]=true;
        }
        for(int i=0;i<4;i++){
            scanf("%d",&b[i]);
            if(a[i]==b[i]) hi++;
            else if(e[b[i]]) bl++;
        }
        printf("%d %d\n",hi,bl);
    }
}

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

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

int main(){
	
	int hit,blow;
	int a[4],b[4];
	
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
		cin>>b[0]>>b[1]>>b[2]>>b[3];
			hit=0;
			blow=0;
		for(int i=0;i<4;i++){
			for(int j=i;j<4;j++){
				if(a[i]==b[j]){
					if(i==j)
						hit++;
					else
						blow++;
					j=4;
				}
			}
		}
		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 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 << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <algorithm>
#include <iostream>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)

int main()
{
  int a[4], b[4];
  while(!cin.eof()){
    REP(i,4) cin >> a[i];
    REP(i,4) cin >> b[i];

    int hit=0, blow=0;
    REP(i,4){
      if(a[i]==b[i])
	hit++;
      else{
	REP(j,4){
	  if(a[i]==b[j])
	    blow++;
	}
      }
    }

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

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

int main(){
	int a[4],b[4],i,j,h,r;
	while( cin >> a[0] ){
		h=0;
		r=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(a[i] == b[j]){
					r++;
				}
			}
			if(a[i] == b[i]){
				h++;
				r--;
			}
		}
		cout << h << " " << r << "\n" ;
	}
return 0;
}

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

int main() {
	vector<int> a(4), b(4);
	while(!cin.eof()){
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) cin >> b[i];
		
		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 << endl;
	}
}

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

#define M 4
int a[M], b[M];

double sub_in(int a[], int n)
{
	for (int i = 0; i < n; i++)
	{
		if (!(cin >> a[i]))
			return false;
	}
	return true;
}

bool in_ab(int a[], int b[], int n)
{
	if (!sub_in(a, n) || !sub_in(b, n))
		return false;
	return true;
}

int hit(int a[], int b[], int n)
{
	int c = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] == b[i])
			c++;
	}
	return c;
}

int blow(int a[], int b[], int n)
{
	int c = 0;
	for(int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
		{
			if (a[i] == b[j])
				c++;
		}
	return c;
}

int main()
{
	while (in_ab(a,b,M))
	{
		cout << hit(a,b,M) << " " << blow(a,b,M) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

vector<char> a(4),b(4);

int main(){
	char c,d,e,f;
	while(cin>>c>>d>>e>>f>>g>>h>>d>>k){
		int hit=0,blow=0;
		a={c,d,e,f};
		b={g,h,d,k};
//		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=0;j<4;j++){
				if(i==j) continue;
				if(a[i]==b[j]) blow++;
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
}