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<stdio.h>
int main(){
  int i=0;
  int data[4];
  while(scanf("%d",&data[i])!=EOF){
    int i,j,hit=0,blow=0;
    int str[4]={0};
    for(i=1;i<4;i++){
      scanf("%d",&data[i]);
    }
    for(i=0;i<4;i++){
      scanf("%d",&str[i]);
    }
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(data[i]==str[j]){
	  if(data[j]==str[j]){
	    hit++;
	  } else{
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }
  return(0);
}

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

int main()
{
	int a[4],b[4],count,count_2;

	while(cin >> a[0] >> a[1] >> a[2] >> a[4])
	{
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		count = 0;
		count_2 = 0;

		for(int i=0;i<4;i++)
		{
			for(int j=0;j<4;j++)
			{
				if(a[i] == b[j])
				{
					if(i == j)
					{
						count++;
					}
					else
					{
						count_2++;
					}
				}
			}
		}
		cout << count << " " << count_2 << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

int bucket[10];
int a[4], b, hit, blow;

int main()
{
	
	while(1)
	{
		if( cin.eof() )
			break;
		
		memset(bucket, 0, sizeof(bucket));
		hit = 0; blow = 0;
		
		for(int i = 0; i < 4; i++)
		{
			cin >> a[i];
			bucket[a[i]] = 1;
		}
		
		for(int i = 0; i < 4; i++)
		{
			cin >> b;
			if( b == a[i] )
				hit++;
			else if( bucket[b] )
				blow++;
		}
		
		cout << hit << " " << blow << endl;	
		
	}
	
	return 0;
}

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

using namespace std;

void check_num(array<int,8> a){
  int hit_num=0,blow_num=0;
  for(int i=0;i<4;i++){
    for(int j = 4;j<8;j++){
      if(a[i] == a[j]){
        if(j-4 == i){
          ++hit_num;
        }else{
          ++blow_num;
        }
      }
    }
  }

  cout<<hit_num<<" "<<blow_num<<endl;
}

int main(void){
  array<int,8> a; //プレイヤーa,bの値
  int input;

  while(cin >> input){
    a[0]=input;
    for(int i = 1;i<8;i++){
      cin >>a[i];
    }
    check_num(a);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int a[4];
	int b[4];
	int hit=0;
	int blow=0;
	int m, n;

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

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

C++: #include<stdio.h>
int main(void)
{
	int a[5],s[5],d,f,g,i,j;
	while(scanf("%d %d %d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4],&s[1],&s[2],&s[3],&s[4])!=EOF){
	d=0;
	f=0;
	for(i=1;i<=4;i++){
		if(a[i]==s[i]){
			d++;
		}
		if(a[i]!=s[i]){
			j=1;
			while(j<5){
				if(a[i]==s[j]){
					f++;
				}
				j++;
			}
		}
	}
	printf("%d %d\n",d,f);
	}
	return 0;
}

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

int main()
{
	int a[5],b[5];
	
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]), a[0] != EOF){
		int hit=0,blow=0;
		
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		
		for(int i=0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				continue;
			}
			blow = count(a,a+4,b[i]);
		}
		printf("%d %d\n", hit, blow);
	}
	
	return (0);
}