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 <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  vi32 a(4), b(4);
  while (cin >> a >> b) {
    int hit = 0, blow = 0;
    rep(i, 4) rep(j, 4) {
      if (a[i] == b[j]) {
        if (i == j) hit++;
        else blow++;
      }
    }
    cout << hit << " " << blow << '\n';
  }
}

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={c,d,e,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 <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] && cin >> b[0] >> b[1] >> b[2] >> b[3]){
		int A[10] = {0}, B[10] = {0}, h = 0, br = 0;
		for (int i = 0; i < 4; ++i)
		{
			A[a[i]]++;
			B[b[i]]++;
		}
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]){
				h++;
				A[a[i]]--;
				B[b[i]]--;
			}
			//cout << a[i]  << b[i] << endl;
		}
		for (int i = 0; i < 10; ++i)
		{
			if(A[i] == 1 && B[i] == 1){
				br++;
			}
		}
		cout << h << ' ' << br << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){
int aa[4], bb[4];
int ht, bl;

	while(1){
		rep(i,4) cin >> aa[i];
		rep(i,4) cin >> bb[i];
		ht = 0; bl = 0;
		rep(i,4) rep(j,4) {
			if(aa[i] == bb[j]){
				if(i==j) ht++;
				else     bl++;
			}
		}	
		cout << ht << " " << bl << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		bool blowlist[10];
		for(auto& i : blowlist)
			i = false;

		int b[4];
		for(auto& i : b)
			cin >> i;

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

		cout << hit << ' ' << blow << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
	int a[4],b[4];
	while(~scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3])){
		
		scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3]);
		int 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++;
		printf("%d %d\n",hit,blow);
	}
}

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

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    while(1){
        vector<int> a(4);
        vector<int> b(4);
        rep(i,4) cin >> a[i];
        rep(i,4) cin >> b[i];
        int hit = 0,blow = 0;
        rep(i,4){
            if(a[i] == b[i]) hit++;
            else {
                rep(j,4) if(a[j] == b[i]) blow++;
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}