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

int main(void) {
	int a[4];
	int 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 << endl;
	}
	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] >> b[0] >> b[1] >> b[2] >> b[3]){
		int hit = 0;
		for (int i = 0; i < 4; i++){
			if (a[i] == b[i])
				hit++;
		}
		int blow = 0;
		for (int i = 0; i < 4; i++){
			for (int j = 0; j < 4; j++){
				if (a[i] == b[j] && i != j){
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

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

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		hit=0;
		blow=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++;
			}
		}
		std::cout << hit << blow-hit << std::endl;
	}

    return 0;
}

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

int main()
{
	
	int a[4], b[4];
	while(cin>>a[0]){
		
		int i,j;
		for(i=1;i<4;i++){
			cin>>a[i];
		}
		for(i=0;i<4;i++){
			cin>>b[i];
		}
		
		int hit = 0;
		int blow = 0;
		for(i=0;i<4;i++){
			if(a[i] == b[i]){
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i] == b[j] && i != j){
					blow++;
				}
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
	return 0;
}

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

int main()
{

    int a[4], b[4];
    set<int> c;
    while(scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3)!=EOF)
    {
        c.clear();
        for(int i=0; i<4; i++)
        {
            c.insert(a[i]);
        }
        int d=0,e=0;
        for(int i=0; i<4; i++)
        {
            if(b[i]==a[i])
            {
                d++;
                e++;
            }
            else if(c.find(b[i])!=c.end())
                e++;
        }
        printf("%d %d\n",d,e-d);
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

    cout << hit << " " << blow << 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;
		int 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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a[4];
	int b[4];
	while(cin >> a[0]){
		int hit = 0;
		int brow = 0;
		FOR(i,1,4){
			cin >> a[i];
		}
		rep(i,4){
			cin >> b[i];
			if(a[i] == b[i])hit++;
		}
		rep(i,4)rep(j,4){
			if(a[i] != -1 || b[j] != -1)continue;
			if(a[i] == b[j]){
				brow++;
				a[i] = -1; b[j] = -1;
			}
		}
		cout << hit << " " << (brow-hit) << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a[5],b[5];
	int x;
	while(cin>>x){
		a[0]=x;
		for( int i=1 ; 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 <bits/stdc++.h>
using namespace std;

bool input( int a[], int b[], int n ) {
	for( int i = 0; i < n; ++i ) {
		if( !(cin >> a[i]) ) { return false; }
	}

	for( int i = 0; i < n; ++i ) {
		if( !(cin >> b[i]) ) { return false; }
	}

	return true;
}

int main() {
	ios_base::sync_with_stdio( false );

	constexpr int N = 4;
	int a[N];
	int b[N];

	while( input( a, b, N ) ) {
		int hit = 0;
		int blow = 0;

		for( int i = 0; i < N; ++i ) {
			for( int j = 0; j < N; ++j ) {
				if( b[i] == a[j] ) {
					if( i == j ) {
						hit += 1;
					}
					else {
						blow += 1;
					}
				}
			}
		}

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

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

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

int main(void){
  vector<int> a(4);
  vector<int> b(4);

  while(cin>>a[0]){
    int va[10] = {0};
    int vb[10] = {0};
    va[--a[0]]++;
    for(int i = 1 ; i < 4 ; i ++){
      cin>>a[i];
      va[--a[i]]++;
    }
    int hit = 0;
    for(int i = 0 ; i < 4 ; i ++){
      cin>>b[i];
      if(a[i] + 1 == b[i]){
	hit++;
      }
      vb[--b[i]]++;
    }
    int blow = 0;
    for(int i = 0 ; i < 10 ; i ++){
      blow += min(va[i],vb[i]);
    }
    cout<<hit<<" "<<blow-hit<<endl;
  }
}

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

C++: #include<iostream>
#include<string>
#include<algorithm>

using  namespace std;

int main(){
	int a[4];
	int b[4];
	int hit, blow;


	while (cin >> a[0]){
		cin >> a[1];
		cin >> a[2];
		cin >> a[3];
		cin >> b[0];
		cin >> b[1];
		cin >> b[2];
		cin >> 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] && i == j){
					hit++;
				}
				if (a[i] == b[j] && i != j){
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;

	}

}