Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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

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

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

    for(int i=0; i<4; ++i){
        std::cin >> a[i];
    }

    for(int j=0; j<4; ++j){
        std::cin >> b[j];
    }
    
    for(int i=0; i<4; ++i){
        for(int j=0; j<4; ++j){
	    if(a[i] == b[j]){
	        if(i == j)
		    ++hit;
		else if(i != j)
		    ++blow;
	    }
	}
    }

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

    return 0;
}

C++: #include <cstdio>

using namespace std;

int hit = 0, blow = 0,a[4], b[4];

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

    }
    return 0;
}