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>

int main(){
  int a[4];
  int b[4];
  int i,j,hit,blow;

  while(std::cin >> a[0]){
    std::cin >> a[1] >> a[2] >> a[3]
             >> b[0] >> b[1] >> b[2] >> b[3];
    hit = 0;
    blow = 0;
    for(i=0;i<4;i++){
      if(a[i]==b[i]){
        ++hit;
      }
      for(j=0;j<4;j++){
        if(i!=j){
          if(a[i]==b[j]){
            ++blow;
          }
        }
      }
    }
    std::cout << hit << ' ' << blow << std::endl;
  }
}

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

int main(){

	int a1, a2, a3, a4, b1, b2, b3, b4;

	while(std::cin >> a1 >> a2 >> a3 >> a4){
		
		std::cin >> b1 >>b2 >> b3 >>b4;

		std::array<int> A = {a1, a2, a3, a4};
		std::array<int> B = {b1, b2, b3, b4};
		
		int hit = 0;
		int blow = 0;

		for(int i = 0; i < 4; ++i){
			
			if(A[i] == B[i])
				hit++;
				
			count += std::count(A.begin(), A.end(), B[i]);

		}

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

		return 0;

}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x,y;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h){
        if (a==e){x++;e=e+10;} 
        if (b==f){x++;f=f+10;} 
        if (c==g){x++;g=g+10;}
        if (d==h){x++;h=h+10;}
        if (e==a||e==b||e==c||e==d){y++;}
        if (f==a||f==b||f==c||f==d){y++;}
        if (g==a||g==b||g==c||g==d){y++;}
        if (h==a||h==b||h==c||h==d){y++;}
        cout << x << y << endl;
    
    
    }
return 0 ;
}

C++: // 0025 Hit and Blow
#include <iostream>
using namespace std;

int main()
{
	int a[3]; // 正解の数字
	int b[3]; // 回答者の数字
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ // 正解の数字を入力
	  int hit  =0; // 初期値
	  int blow =0; // 初期値

	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; // 結果を出力
	}
}

C++: #include <iostream>

using namespace std;

int a[4], b[4];
void solve(){
  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++;
      }
    }
  }
  cout << hit << " " << blow << endl;
}
int main(){

  while( cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3] ){
    solve();
  }
  
  return 0;
}

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

}

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

void get(int* nums_a,int* nums_b){
  int nums_a[4];
  int nums_b[4];
  for(int i=0;i<4;i++){
    cin>>nums_a[i];
  }
  for(int i=0;i<4;i++){
    cin>>nums_b[i];
  }
}

int main(){
  vector<int> hit_anss;
  vector<int> bolor_anss;
  int hit=0,bolor=0;
  while(get(nums_a,nums_b)){
    //hit????¢????
    for(int i=0;i<4;i++){
      if(nums_a[i]==nums_b[i])hit++;
    }
    //bolor????¢????
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j)continue;
        if(nums_a[i]==nums_b[j]){
          bolor++;
          break;
        }
      }
    }
    hit_anss.push_back(hit);
    bolor_anss.push_back(bolor);
  }
  for(int i=0;i<hit_anss.size();i++){
    cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl;
  }
}

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

int a[4];
int b[4];
int hit,blo;

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

C++: #include <iostream>

using namespace std;

int main()
{
  int a[4], b[4];
  int blow, hit;

  
  while(cin >> a[0] == EOF){
    cin >> a[1] >> a[2] >> a[3];
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    hit = blow = 0;
    for(int i = 0; i < 4; i++){
      if(a[i] == b[i]){
        hit += 1;
      }
    }
    for(int i = 0; i < 4; i++){
      for(int n = 0; n < 4; n++){
        if(a[i] != b[i] && a[i] == b[n]){
          blow++;
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
  return 0;
}

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

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

  return 0;
}

C++: #include <stdio.h>
#include <string.h>

int a[4], b[4];
bool visa[4], visb[4];

int main()
{
    //freopen("data.in", "r", stdin);
    int i, j, cnt1, cnt2;
    while(scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]) != EOF)
    {
        cnt1 = cnt2 = 0;
        memset(visa, false, sizeof visa);
        memset(visb, false, sizeof visb);
        for(i = 0; i < 4; i ++) 
            scanf("%d", &b[i]);
        for(i = 0; i < 4; i ++)
            if(!visa[i] && !visb[i] && a[i] == b[i])
                visa[i] = visb[i] = true, cnt1 ++;
        for(i = 0; i < 4; i ++)
        {
            if(!visa[i])
            {
                for(j = 0; j < 4; j ++)
                {
                    if(!visb[j] && a[i] == b[j])
                    {
                        cnt2 ++;
                        visa[i] = true;
                        visb[j] = true;
                        break;
                    }
                }
            }
        }
        printf("%d %d\n", cnt1, cnt2);
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
    int a[4],b[4];
    int d[10];
    int n,m;
    while(1)
    {
        n=m=0;
        memset(d,0,sizeof(d));
        for(int i=0;i<4;i++)
            scanf("%d",&a[i]);
        for(int i=0;i<4;i++)
        {
            scanf("%d",&b[i]);
            if(a[i]==b[i])
                n++;
            else
            {
                d[a[i]]++;
                d[b[i]]++;
            }
        }

        if(a[0]==EOF)
            break;
        if(n==4)
            printf("%d %d\n",n,m);
        else
        {
            for(int i=0;i<=9;i++)
            {
                if(d[i]==2)
                m++;
            }
            printf("%d %d\n",n,m);
        }
    }
    return 0;
}

C++: #include<string>
#include<cmath>
#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 ht=0, br=0;

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

		cout<<ht<<" "<<br-ht<<endl;
	}
    return 0;
}