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<cstdio>
using namespace std;
int main(){
int vx[]={ 0, 1,-1, 0, 0,-1,-1, 1, 1, 2,-2, 0, 0};
int vy[]={ 0, 0, 0, 1,-1,-1, 1,-1, 1, 0, 0, 2,-2};
int x,y,size;
int map[10][10];
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
map[i][j]=0;
}
}
int nm_ans=0,max_ans=0;
while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
switch(size){
case 1:
for(int i=0;i<5;i++){
if((min(x+vx[i],y+vy[i])>=0)&&max(x+vx[i],y+vy[i])<10){
map[x+vx[i]][y+vy[i]]++;
}
}
break;
case 2:
for(int i=0;i<9;i++){
if((min(x+vx[i],y+vy[i])>=0)&&max(x+vx[i],y+vy[i])<10){
map[x+vx[i]][y+vy[i]]++;
}
}
break;
case 3:
for(int i=0;i<13;i++){
if((min(x+vx[i],y+vy[i])>=0)&&max(x+vx[i],y+vy[i])<10){
map[x+vx[i]][y+vy[i]]++;
}
}
break;
}
}
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(map[i][j]>max_ans){
max_ans=map[i][j];
}
if(map[i][j]==0){
nm_ans++;
}
}
}
cout<<nm_ans<<endl;
cout<<max_ans<<endl;
return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int i,j;
	int hit,blow;
	int dataA[4],dataB[4];

	while(scanf("%d",&dataA[0])!=EOF) {

		hit=0;
		blow=0;

		for(i=1;i<4;i++){
			scanf("%d",&dataA[i]);
		}
		
		for(i=0;i<4;i++) {
			scanf("%d",&dataB[i]);
		}

		for(i=0;i<4;i++) {
			for(j=0;j<4;j++){
				if(dataA[i] == dataB[j] && i==j) {
					hit++;
				}
				else if(dataA[i] == dataB[j] && i!=j){
					blow++;
				}
			}
		}

		printf("%d %d\n",hit,blow);
		}

		return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
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, 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++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

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



int main()
{
    int hit[4]={},blow[4]={};
    while(cin>>hit[0]){
        int ans1=0,ans2=0;
        for(int i=1; i<4; i++){
            cin>>hit[i];
        }
        for(int i=0; i<4; i++){
            cin>>blow[i];
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(hit[i]==blow[j]){
                    (i==j)?ans1++:ans2++;
                }
            }
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define llong long long

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

C++: #include <stdio.h>

int main(void) {
  int a[4], b[4];
  while (scanf("%d %d %d %d\n%d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF) {
    int i, j;

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

    int blow = 0;
    for (i=0; i<10; ++i) {
      int a_count = 0, b_count = 0;
      for (j=0; j<4; ++j) {
        if (a[j] == i) {
          ++a_count;
        }
        if (b[j] == i) {
          ++b_count;
        }
      }
      blow += (a_count < b_count ? a_count : b_count);
    }
    blow -= hit;

    printf("%d %d\n", hit, blow);
  }

  return 0;
}

C++: #include <iostream>
#include <array>
void counter(int* n_a,int* n_b,int* hit,int* blow);

int main() {

	std::array<int, 4> n_a;//selection of "A"
	std::array<int, 4> n_b;//selection of "B"

	while (std::cin) {
		std::cin >> n_a[0] >> n_a[1] >> n_a[2] >> n_a[3];
		std::cin >> n_b[0] >> n_b[1] >> n_b[2] >> n_b[3];

		int hit = 0;//factor and place are same
		int blow = 0;//only factor is same

		counter(n_a.data(),n_b.data(),&hit,&blow);

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

}

/*This function is a counter for "hit" and "blow".*/
void counter(int* n_a,int* n_b,int* hit,int* blow) {

	*hit = 0;
	*blow = 0;
	
	for (int i = 0; i < 4; ++i){
		for (int j = 0; j < 4; ++j){
			//the case of factor and place are same
			if (n_a[i] == n_b[j] && i == j) {
				*hit = *hit + 1;
			}
			//the case of only factor is same
			else if (n_a[i] == n_b[j]) {
				*blow = *blow + 1;
			}
			//otherwise
			else {
				//nothing to do
			}
		}
	}

	return;
}

C++: /***** ?????¬???????????¬?????? *****/

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

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    set<int>s1, s2;
    int a[4], b[4];
    while(1) {
        rep(i,0,4) {
            cin >> a[i];
            s1.insert(a[i]);
        }
        rep(i,0,4) {
            cin >> b[i];
            s2.insert(b[i]);
        }

        int hit = 0, blow = 0;
        rep(i,0,4) {
            if(a[i] == b[i]) hit++;
            else if(s1.count(b[i]) != 0) blow++;
        }

        printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(h != '\0'){
		
		h=0;
		br=0;
		
		for(int i=0;i<4;i++) cin >> a[i];
		for(int j=0;j<4;j++) cin >> b[j];
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		
		cout << h << ' '<< br << endl;
	}
}

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

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

int main(){
  int a[4],c[4];
  while(1){
    int e=0,b=0;
    for(int i=0;i<4;i++)
      cin >> a[i];
    for(int i=0;i<4;i++){
      cin >> c[i];
      for(int j=0;j<4;j++)
	if(c[i]==a[j]){
	  if(i==j)e++;
	  else b++;
	}
    }
    cout<<e<<' '<<b<<endl;
  }
  return 0;
}