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 <map>
#include <vector>

using namespace std;
#define N 4

int main(void)
{
    ios::sync_with_stdio(false);
    int a[N], b[N];
    int hit, blow;

    while(cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()) {
        for(int i=0; i<N; i++) cin >> b[i];

        hit = blow = 0;
        for(int i=0; i<N; i++) {
            for(int j=0; j<N; j++) {
                if(a[i] == b[j]) {
                    if(i == j) hit++;
                    else blow++;
                }
            }
        }

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

    return 0;
}

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

int main(void){
    int a[4];
    int b[4];
    
    while((scanf("%d", a[0])) != EOF){
        int hitcount = 0;
        int bcount   = 0;
        
        for(int i = 1; i < 4; i++){
            scanf("%d", a[i]);
        }
        
        for(int i = 0; i < 4; i++)
            cin >> b[i];
        
        //a???????????????????????????????´????b????????¢??¢?´¢
        for(int i = 0; i < 4; i++){
            int x = a[i];
            for(int j = 0; j < 4; j++){
                if(x == b[j]){
                    if(i == j) hitcount++;
                    else bcount++;
                }
            }
        }
        
        cout << hitcount << " " << bcount << 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;
				continue;
			}
			for (int j = 0; j < 4; ++j){
				if (i == j) continue;
				if (A[i] == B[j]) ++blow;
			}
		}
		cout << hit << " " << blow << "\n";
	}
	return 0;
}

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

int main() {
	array<int, 4> a, b;
	while (1) {
		for (auto& A : a) cin >> A;
		for (auto& B : b) cin >> B;
		if (!cin) break;
		
		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++;
					}
					break;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

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

int main(void){
  int a[4];
  int b[4];
  int count=0;
  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<3; i++){
    for(int j=i+1; j<4; j++){
      if(a[i] == a[j]){
        count++;
      }
      if(b[i] == b[j]){
        count++;
      }
    }
  }
  if(count==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;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int num[4], tmp[4], hit, blow;
	
	while (1) {
		hit = 0; blow = 0;
		
		cin >> num[0] >> num[1] >> num[2] >> num[3];
		cin >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3];
		
		for (int i=0; i<4; i++)
			for (int j=0; j<4; j++)
				if (num[i] == tmp[j]) {
					if (i == j) hit++;
					else		blow++;
				}
		cout << hit << " " << blow << endl;
		
		if (cin.eof()) break;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a[5],s[5],d,f,g,i,j;
	while(scanf("%d %d %d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4],&s[1],&s[2],&s[3],&s[4])!=EOF){
	d=0;
	f=0;
	for(i=1;i<=4;i++){
		if(a[i]==s[i]){
			d++;
		}
		if(a[i]!=s[i]){
			j=0;
			while(j<=5){
				if(a[i]==s[j]){
					f++;
				}
				j++;
			}
		}
	}
	printf("%d %d\n",d,f);
	}
	return 0;
}

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

int main(){
	char 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++){
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j] && i == j) hit++;
				else if(a[i] == b[j]) blow++;
			}
		}
		cout <<hit <<" " <<blow <<endl;
	}
	return 0;
}

C++: #include <iostream>

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

	while (std::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 < size; i++)
			if (a[i] == b[i]) {
				hit++;
			} else {
				for (int j = 1; j < size; j++)
					if (a[i] == b[j])
						blow++;
			}

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
		VI a = { a1,a2,a3,a4 };
		VI b = { b1,b2,b3,b4 };

		int c1 = 0, c2 = 0;
		rep(i, 4) {
			if (a[i] == b[i])c1++;
		}

		VI ca(10), cb(10);
		rep(i, 4)ca[a[i]]++;
		rep(i, 4)cb[b[i]]++;
		rep(i, 10) {
			c2 += min(ca[i], cb[i]);
		}

		cout << c1 << " " << c2 - c1 << endl;
	}
}

C++: #include <cstdio>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int a[4],b[4];
  while(1){
  rep(i,4)cin >> a[i];
  rep(i,4)cin >> b[i];

  int blow=0,hit=0;

  rep(i,4){
    if(a[i]==b[i])hit++;
}
  rep(i,4)for(int j=0;j<4;j++){
    if(a[i]==b[j]&&i!=j)blow++;
}
  cout << hit <<" "<< blow << endl;
  }

}

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

int main()
{
  vector<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 < a.size(); ++i) {
      for (int j = 0; j < b.size(); ++j) {
	if (a[i] == b[j]) {
	  if (i == j)
	    ++hit;
	  else
	    ++blow;
	}
      }
    }

    cout << hit << " " << blow << endl;

  }
  return 0;
}