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 <array>

int main(){
  std::array<int, 4> a = {};
  std::array<int, 4> b = {};
  int hit = 0;
  int blow = 0;
  int N = 0;

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

    hit = 0;
    blow = 0;
    ++N;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	while(true)
	{
		vint a(4), b(4);

		rep(i, 4)
			cin >> a[i];
		rep(i, 4)
			cin >> b[i];

		int blow = 0, hit = 0;
		rep(i, 4)
		{
			if(a[i] == b[i])
				hit++;
			else
				blow += (0 < count(ALL(b), a[i]));
		}

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

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

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

	while(1)
	{
		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 res[4];
		for(int i=0; i<4; i++)
		{
			if(A[i] == B[i])
			{
				res[i] = 1;
			}
			else
			{
				for(int j=0; j<4; j++)
					if(A[j] == B[i])res[i] = 2;
			}
		}

		int hit=0, blow=0;
		for(int i=0; i<4; i++)
		{
				 if(res[i] == 1)hit++;
			else if(res[i] == 2)blow++;
		}
		cout << hit << ' ' << blow << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a[4],b,i,j,Hit,Blow,x=0;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF)
	{
		Hit=0;
	    Blow=0;

		for(i=0;i<4;i++)
		{
			scanf("%d",&b);
			if(b==a[i])
				Hit++;
			else
				for(j=0;j<4;j++)
				{
					if(b==a[j])
					{
						Blow++;
						break;
					}
				}
		}
		printf("%d %d\n",Hit,Blow);
	}
  return 0;
}

C++: #include<cstdio>
int main(){
  int a1,a2,a3,a4,b1,b2,b3,b4;
  while(scanf("%d %d %d %d",&a1,&a2,&a3,&a4)>0){
    scanf("%d %d %d %d",&b1,&b2,&b3,&b4);
    int h=0,b=0;
    if(b1==a1) h++;
    if(b1==a2||b1==a3||b1==a4) b++;
    if(b2==a2) h++;
    if(b2==a1||b2==a3||b2==a4) b++;
    if(b3==a3) h++;
    if(b3==a1||b3==a2||b3==a4) b++;
    if(b4==a4) h++;
    if(b4==a1||b4==a2||b4==a3) b++;
    printf("%d %d\n",h,b);
  }
}

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

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


		//blow
		int blow = 0;
		for (int i = 0; i < 4; i++)
			blow += ((a[i] == b[0]) || (a[i] == b[1]) || (a[i] == b[2]) || (a[i] == b[3]));

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

	return 0;
}

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

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

		for(int i=0;i<4;++i){
			if(a[i] == b[i])
				++hit;
		}

		blow -= hit;	
		cout << hit << " " << blow << endl;

	}
	return 0;
}

C++: #include<iostream>

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

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

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

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]>> b[0] >> b[1] >> b[2] >> b[3]){
		
		h=0;
		br=0;
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		
		cout << h << ' '<< br << endl;
	}
}

C++: #include <iostream>
using namespace std;
 
int main() {
 
  int a[4],b[4];
 
  while(true) {
 
  
 
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3];
 
  if ( cin.eof() ) break;

    int hit = 0;
    int blow = 0;
 
    for ( int i = 0; i < 4; i++ ) {
 
      for ( int j = 0; j < 4; j++ ) {
 
    int k = ( i + j ) % 4;
 
    if ( a[i] == b[k] ) {
 
      if ( i == k ) {
        hit++;
      }else {
        blow++;
      }
      break;
 
    }
 
      }
 
    }
 
    cout << hit << " " << blow << endl;
 
  }
 
  return 0;
 
}