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 <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int hit=0,blow=0;
		rep(i,1,4) cin>>a[i];
		rep(i,0,4) cin>>b[i];
		rep(i,0,4){
			rep(j,i,4){
				if(a[i]==b[j]){
					if(i==j) hit++;
					else blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

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

int main()
{
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (scanf("%d %d %d %d %d %d %d %d", &a1, &a2, &a3, &a4, &b1, &b2, &b3, &b4) != EOF)
	{
		int hit = 0, blow = 0;
		if (a1 == b1)hit++;
		if (a2 == b2)hit++;
		if (a3 == b3)hit++;
		if (a4 == b4)hit++;

		if (a1 == b2)blow++;
		if (a1 == b3)blow++;
		if (a1 == b4)blow++;
		if (a2 == b1)blow++;
		if (a2 == b3)blow++;
		if (a2 == b4)blow++;
		if (a3 == b1)blow++;
		if (a3 == b2)blow++;
		if (a3 == b4)blow++;
		if (a4 == b1)blow++;
		if (a4 == b2)blow++;
		if (a4 == b3)blow++;

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

	}
	return 0;
}

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