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<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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 H = 0, B = 0;
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++)
				if (a[i] == b[j])B++;
			if (a[i] == b[i]) {
				B--; H++;
			}
		}
		cout << H << " " << B << endl;
	}

	return 0;
}

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

std::vector<int> a, b;
int hit, blow;

int main()
{
	while( 1 ){
		hit = blow = 0;
		a.clear();
		b.clear();
		
		for( int i = 0; i < 4; i++ ){
			int n;
			if( !( std::cin >> n ) ) goto end;
			a.push_back( n );
		}
		
		for( int i = 0; i < 4; i++ ){
			int n;
			if( !( std::cin >> n ) ) goto end;
			b.push_back( n );
		}
		
		for( int i = 0; i < 4; i++ ){
		 	if( a[i] == b[i] ){
			 	hit++;
			}
		}
		
		for( int i = 0; i < 4; i++ ){
			blow += std::count( a.begin(), a.end(), b[i] );
		}
		blow -= hit;
		
		std::cout << hit << " " << blow << std::endl;
	}

end:

 	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	vector<int>as(4), bs(4);
	while (cin >> as[0]) {
		for (int i = 0; i < 3; ++i) {
			cin >> as[i + 1];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> bs[i];
		}
		int hit = 0, blow = 0;
		for (int i = 0; i < 4;++i){
			if (as[i] == bs[i])hit++;
			for (int j = 0; j < 4; ++j) {
				if (i == j)continue;
				if (as[i] == bs[j])blow++;
			}
		}
		
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

C++: #include <iostream>
#include <string>
using namespace std;
 
int main()
{
    int a[4],b[4],i,j,hit,blow;
    while(cin >> a[0]){
        for (i = 1 ; i < 4 ; i++){
            cin >> a[i];
        }
        for(i = 0 ; i < 4 ; i++){
            cin >> b[i];
        }
        hit = 0;
        blow = 0;
        for(i = 0 ; i < 4 ; i++){
            if(a[i] == b[i]){
                hit++;
            } else {
                for(j = 0 ; j < 4 ; j++){
                    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]){
    int hit = 0,blow = 0;
    for(int i=0; i<4; i++){
      if(a[i] == b[i]){hit++; a[i] = 10; b[i] = 11;}
    }
    for(int i=0; i<4; i++){
      for(int j=0; j<4; j++){
	if(a[i] == b[j]){blow++; a[i] = 10; b[j] = 11;}
      }
    }
    cout <<hit<<" "<<blow<<endl;
  }
  return 0;
}

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

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

struct HitAndBlow
{
    vector<int> cards;

    HitAndBlow(){
        cards = vector<int>(4);
    }

    void board(const HitAndBlow &other) const {
        int hit = 0, blow = 0;
        for (int i = 0; i < cards.size(); i++)
            for (int j = 0; j < cards.size(); j++)
                if (i == j) {
                    if (cards[i] == other.cards[j])
                        hit++;
                } else if (cards[i] == other.cards[j])
                    blow++;
        cout << hit << " " << blow << endl;
    }
};

istream &operator >> (istream &is, HitAndBlow &g)
{
    for (int i = 0; i < g.cards.size(); i++)
        is >> g.cards[i];
    return is;
}

int main()
{
    for (HitAndBlow braker, maker; cin >> braker >> maker;)
        maker.board(braker);

    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
  int a1, a2, a3, a4;
  while(cin >> a1 >> a2 >> a3 >> a4){
    int a[4];
    int b[4];
    int H = 0, B = 0; 
    a[0] = a1;
    a[1] = a2;
    a[2] = a3;
    a[3] = a4;
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    for(int i = 0; i < 4; i++){
      for(int j = 0; j < 4; j++){
	if(b[i] == a[j]){
	  B++;
	  if(i == j){
	    B--;
	    H++;
	  }
	}
      }
    }
    cout << H << ' ' << B << endl;
  }
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
 int a[4],b[4],h,bb,i;
 while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
  h=bb=0;
  for(i=0;i<4;i++)if(a[i]==b[i])h++;
  sort(a,a+4);sort(b,b+4);
  for(i=0;i<4;i++)if(find(b,b+4,a[i])!=b+4)bb++;
  bb -= h;
  cout<<h<<" "<<bb<< endl;
 }
}

C++: #include <iostream>

using namespace std;

int main() {

	int A, a[4] = {}, b[4] = {};

	for (int t = 0; t < 50; t++) {
		int hit = 0, blow = 0;
		cin >> A;
		if (cin.eof()) {
			break;
		}
		else {
			a[0] = A;
			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 (a[i] == b[j]) {
						if (i == j) {
							hit++;
						}
						else {
							blow++;
						}
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}

	return 0;
}