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>
  
int main(){
    std::vector<int> a(4);
      
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
          
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
              
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
                ++hit;
            }
            else if(it != a.end()){
                ++blow;
            }
        }
        std::cout << hit << " " << blow << std::endl;
    }
     
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <set>

using namespace std;

int main()
{
  int a[4], b[4];
  set<int> A, B;
  while (scanf("%d ", &a[0]) == 1) {
    A.clear(), B.clear();
    for (int i = 1; i < 4; i++) {
      scanf("%d ", &a[i]);
      A.insert(a[i]);
    }
    for (int i = 0; i < 4; i++) {
      scanf("%d ", &b[i]);
      B.insert(b[i]);
    }
    int hit = 0, blow = 0;
    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 (b[i] == a[j]) {
	  blow++;
	}
      }
    }
    
    printf("%d %d\n", hit, blow - hit);
  }
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        vector<int> a(4), b(4);
        for(int i=0; i<4; ++i)
            if(!(cin >> a[i]))
                return 0;
        for(int i=0; i<4; ++i)
            cin >> b[i];

        int ret = 0;
        for(int i=0; i<4; ++i)
            if(a[i] == b[i])
                ++ ret;
        cout << ret << ' ';

        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        ret = -ret;
        int i=0, j=0;
        while(i < 4 && j < 4){
            if(a[i] < b[j])
                ++ i;
            else if(a[i] > b[j])
                ++ j;
            else{
                ++ ret;
                ++ i;
                ++ j;
            }
        }
        cout << ret << endl;
    }
}

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

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

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

int main() {

  int a[4],b[4];

  while(true) {

    if ( cin.eof() ) break;

    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++ ) {

	int k = ( i + j ) % 4;

	if ( a[i] == b[k] ) {

	  if ( i == k ) {
	    hit++;
	  }else {
	    blow++;
	  }
	  break;

	}

      }

    }

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

  }

  return 0;

}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
int a[4];
int b[4];
int c;
int d;
int e;
int f;
while(cin >>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
e=0;
f=0;
c=0;
while(c<4){
d=0;
while(d<4){
if(a[c]==b[d]){if(c==d){e=e+1;} else{f=f+1;}
d=d+1;}
c=c+1;}
cout <<e<<" "<<f<<endl;
}}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int a[4],d[4];
	while(true){
		int h=0,b=0;
		cin>>a[0]>>a[1]>>a[2]>>a[3]>>d[0]>>d[1]>>d[2]>>d[3];;
		if (cin.eof())break;
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i==j&&a[i]==d[j]) h++;
				if(i!=j&&a[i]==d[j]) b++;
			}
		}
		cout<<h<<" "<<b<<endl;
	}
}

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

C++: #include <iostream>
#include <stdio.h>
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,bl_a=0,bl_b=0,blow=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i])hit++;
			else{bl_a+=1<<(a[i]-1);bl_b+=1<<(b[i]-1);}
		}
		int ans=bl_a&bl_b;
		for(int i=0;i<10;i++)if(ans>>i&1)blow++;
		printf("%d %d\n",hit,blow);
	}
    return 0;
}

C++: #include <iostream>
#include <vector>
bool input (std::vector<int> & v)
{
	for (std::vector<int>::size_type i = 0; i < v.size(); i++) {
		if(!(std::cin >> v[i])) return false;
	}
	return true;
}
void get_hit_blow(int & hit, int & blow, std::vector<int> a, std::vector<int> b)
{
	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;
		}
	}
}
int main()
{
	std::vector<int> a(4), b(4);
	while (input(a) && input(b)) {
		int hit = 0, blow = 0;
		get_hit_blow(hit, blow, a, b);
		std::cout << hit << ' ' << blow - hit << std::endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;


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

  while(cin >> a[0]){
    cin >> 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;
  }
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int a[4], b[4];
	while (!feof(stdin))
	{
		for (int i = 0; i < 4; ++i)
			scanf("%d", a+i);
		for (int i = 0; i < 4; ++i)
			scanf("%d", b+i);

		set<int> included;
		for (int i = 0; i < 4; ++i)
			included.insert(a[i]);
		
		int hit, blow;
		hit = blow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i])
				++hit;
			else if (included.count(b[i]) > 0)
				++blow;
		}
		printf("%d %d\n", hit, blow);
	}
	
	return 0;
}