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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	for(vector<int> a(4), b(4); cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3];) {
		int hit = 0, blow = 0;
		rep(i,4) {
			if(a[i] == b[i])
				hit++;
			else {
				if(EXIST(a, b[i])) {
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

C++: #include <iostream>

int main(int argc, char **argv)
{
	while(true){
		int a[4];
		int b[4];
		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++){
			if(a[i] == b[i]){
				hit++;
			}else{
				for(int j = 0; j < 4; j++){
					if(a[i] == b[j]){
						blow++;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}
	return 0;
}

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

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

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,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;

int main() {
     while(1){
	int d[3],c[3],y,g=0,b=0;
    
    for(int i=0;i<8;i++){
       cin>>y;
       if(i<4){
           d[i]=y;
        }
       else{
          c[i]=y;
       }
     }

    for(int j=0;j<4;j++){
     if(d[j]==c[j]){
       g++;
      }
      for(int k=0;k<4;k++){
         if(d[j]==c[k] &&  j!=k){
            b++;
         }
       }
     }
     cout<<g<<" "<<b<<endl;
    }
    
	return 0;
}

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

int main(){

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

C++: #include<stdio.h>

int main(){
    /*    int m[10];
    int i,j,k;

    for(i = 0; i < 10; i++){
        scanf("%d",&m[i]);
    }

    for(j = 0; j < 9; j++){
        for(k = 0; k < 9-j; k++){
            if(m[k] < m[k+1]){
                int num = m[k+1];
                m[k+1] = m[k];
                m[k] = num;
            }
        }
    }

    for(i = 0; i < 3; i++){
        printf("%d\n",m[i]);
    }
    */

    int x[4],y[4];
    int i,j;
    int hit = 0,blow = 0;

    for(i = 0; i < 4; i++){
        scanf("%d",&x[i]);
    }
    for(i = 0; i < 4; i++){
        scanf("%d", &y[i]);
    }

    for(i = 0; i < 4; i++){
        if(x[i] == y[i]){
            hit++;
        }
    }
    for(i = 0; i < 4; i++){
        for(j = 0; j < 4; j++){
            if(x[i] == y[j] && i != j){
                blow++;
            }
        }
    }

    printf("%d %d",hit,blow);

    return 0;
}

C++: #include <iostream>

int main() {
	const int size = 4;
	int a[size], b[size];

	while (std::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 < size; i++)
			if (a[i] == b[i]) {
				hit++;
			} else {
				for (int j = 1; j < size; j++)
					if (a[i] == b[j])
						blow++;
			}

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

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

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

int main(){

  int n, hit, blow, b[4];
  int a[10][2] = {0};

  while(cin >> b[0] >> b[1] >> b[2] >> b[3]){
    hit = 0;
    blow = 0;
    for(int i=1; i<=4; i++){
      a[b[i-1]][1] = i;
    }

    for(int i=1; i<=4; i++){
      cin >> n;
      if(a[n][1] == i) hit++;
      else if(a[n][1] != 0) blow++;
    }
    cout << hit << " " << blow << endl;    
  }

  return 0;

}

C++: 
#include <iostream>

using namespace std;

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

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