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 <stdio.h>

bool d[12];

int a[4];
int b[4];

int main()
{
while(1 == scanf("%d",a))
{
for(int i = 1; i < 4; i++)
{
scanf("%d",a + i);
}
for(int i = 0; i < 4; i++)
{
scanf("%d",b + i);
}
for(auto& i : d)
{
i = false;
}
for(auto i : a)
{
d[i] = true;
}
int hi = 0;
int bu = 0;
for(int i = 0; i < 4; i++)
{
if(a[i] == b[i])
{
hi++;
}
else if(d[b[i]])
{
bu++;
}
}
}
}

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

int main(){
	int Hit = 0 , Blow = 0;
	char a[4],b[4];
	while(cin >> a >> b){
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4 ; j++){
				if(a[i] == a[j]) Blow++;
			}
		}

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

		cout << Hit << " " << Blow << "\n";
	}

}

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

int main() {
	vector<int> a(4), b(4);
	while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
		for (int i = 0; i < 4; i++) {
			cin >> b[i];
		}
		int hit = 0, brow = 0;
		for (int i = 0; i < a.size(); i++) {
			if(a[i]==b[i])hit++;
			for (int j = 0; j < b.size(); j++) {
				if (i != j && a[i] == b[j])brow++;
			}
		}
		cout << hit << " " << brow << endl;
	}
	return 0;
}

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

int main()
{
    int a[4],b[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3],!cin.eof()){
        int Hit=0,Blow=0;
        bool hantei[4];
        cin>>b[0]>>b[1]>>b[2]>>b[3];
        if(cin.eof()){
            break;
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i]){
                Hit++;
                hantei[i]=true;
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i!=j && !(hantei[i]) && b[i]==a[j]){
                    Blow++;
                    break;
                }
            }
        }
        cout<<Hit<<' '<<Blow<<endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int h = 0, v = 0;
	int a[5], b[5];
	while (cin  >>a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		REP(i,4){
			REP(j, 4){
				if (b[i] == a[j]){
					v++;
					if (i == j){
						v--;
						h++;
					}
				}
			}
		}
		cout << h << " " << v << endl;
		h = v = 0;
	}
}

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

int main() {
  int a[4], b[4];
  while(cin >> a[0]) {
    for(int i = 1; i < 4; i++) cin >> a[i];
    for(int i = 0; i < 4; i++) cin >> b[i];

    int hit = 0, 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++;
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
}

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<9; ++i) {
      int a_count, b_count;
      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 <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

vector<char> a(4),b(4);

int main(){
	char c,d,e,f;
	while(cin>>c>>d>>e>>f){
		int hit=0,blow=0;
		a[0]=c;
		a[1]=d;
		a[2]=e;
		a[3]=f;
		for(int i=0;i<4;i++) cin>>b[i];
		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(i==j) continue;
				if(a[i]==b[j]) blow++;
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-6;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
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]){
        bool f[4]={false};
        int h=0,bb=0;
        for(int i=0;i<4;i++){
            if(a[i]==b[i]){
                f[i]=true;
                h++;
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(f[j])continue;
                if(b[i]==a[j]){
                    bb++;
                    break;
                }
            }
        }
        cout<<h<<" "<<bb<<endl;
    }
}

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

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

	while(cin >> a[0]){
		for(int i = 1; i < 4; i++){
			cin >> a[i];
		}
		for(int i = 0; i < 4; i++){
			cin >> b[i];
		}

		int hit = 0, blo = 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{
						blo++;
					}

				}
			}
		}

		cout << hit << " " << blo << endl;
	}

}