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++: #include <iostream>
#include <array>

int main (){

    //data_set : a and b
    std::array<int, 4> data_a;
    std::array<int, 4> data_b;

    while(std::cin >> data_a[0] >> data_a[1] >> data_a[2] >> data_a[3]){
        std::cin >> data_b[0] >> data_b[1] >> data_b[2] >> data_b[3];
        int hit = 0;
        int blow = 0;
        for(int i = 0; i < 4; ++i){
            //if same digit and same num
            if(data_b[i] == data_a[i]) {
                hit++;
            } else {
                //if different digit and same num
                for (int j = 0; j < 4; ++j) {
                    if (data_b[i] == data_a[j]) {
                        blow++;
                    }
                }
            }
        }
        std::cout << hit << " " << blow << std::endl;

    }
}

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

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

  cin >> a[0] >> a[1] >> a[2] >> a[3];
  cin >> b[0] >> b[1] >> b[2] >> b[3];

  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<<"hit "<<blow<<"blow"<<endl;

  return 0;
}

C++: #include <iostream>
int main(){
	int a1,a2,a3,a4;
	int a[4],b[4],c;
	while(std::cin>>a1>>a2>>a3>>a4){
		int o=0,i=0;
			for(int v=0;v<4;v++){
			std::cin>>b[v];
		}
		
			for(int p=0;p<4;p++){
				if(a1==b[p]){
					if(0==p){
						o++;
					}else{
						i++;
					}
					}	if(a2==b[p]){
					if(1==p){
						o++;
					}else{
						i++;
					}
				}
						if(a3==b[p]){
					if(2==p){
						o++;
					}else{
						i++;
					}
					}	if(a4==b[p]){
					if(3==p){
						o++;
					}else{
						i++;
					}
				}
			}
		
	

		std::cout<<o<<" "<<i<<std::endl;
	}
	return 0;


}

C++: #include<iostream>
using namespace std;
int main(){
  int hit,blo;
  int a[4],b[4];
  while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
    hit=0;
    blo=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]) blo++;
      }
    }
    cout<<hit<<' '<<blo<<endl;
  }
}

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

int main(){
	int a[4],b[4];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
		int hit=0,blow=0,f=0,b;
		for(int i=0;i<4;i++)f |= 1<<a[i];
		for(int i=0;i<4;i++){
			cin>>b;
			if(b==a[i])hit++;
			else if(1<<b & f)blow++;
		}
		cout<<hit<<' '<<blow<<endl;
	}
	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\n",hit,blow);

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int a[2][4];
  while(cin>>a[0][0]){
    rep(i,3)cin>>a[0][i+1];
    rep(i,4)cin>>a[1][i];
    int co[2]={0};
    rep(i,4)rep(j,4){
      if(a[0][i]==a[1][j]&&i==j)co[0]++;
      else if(a[0][i]==a[1][j])co[1]++;
    }
    cout<<co[0]<<" "<<co[1]<<endl;
  }
}

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

using namespace std;

int main(){
	int a[4], b[4];
	while (scanf("%d %d %d %d %d %d %d %d", &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++){
				if (a[i] == b[j]){
					if (i == j) hit++;
					else blow++;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a[4],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;
			if(a[i]==b)H++;
			for(int j=0;j<4;j++){
				if(a[j]==b&&a[i]!=b)B++;
			}
		}
		if(H==4)break;
		cout<<H<<" "<<B<<endl;;
	}
	return 0;
}