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>
using namespace std;

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

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int s[4];
int t[4];

int main(){
	ios::sync_with_stdio(false);
	do{
		REP(i,4){
			if (!(cin>>s[i])){
				return 0;
			}
		}
		REP(i,4){
			cin>>t[i];
		}
		int h=0,b=0;
		REP(i,4){
			REP(j,4){
				if (s[i]==t[j]){
					if (i==j){
						h++;
					}
					else{
						b++;
					}
				}
			}
		}
		cout<<h<<" "<<b<<endl;
	}while (1);
	return 0;
}

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

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

C++: #include<iostream>
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 aa[10]={};
    int bb[10]={};
    for(int i=0;i<4;i++)
      aa[a[i]]=1;
    for(int i=0;i<4;i++)
      bb[b[i]]=1;
    int blow=0,hit=0;
    for(int i=0;i<10;i++)
      if(aa[i]==bb[i]&&aa[i]==1)
	blow++;
    for(int i=0;i<4;i++){
      if(a[i]==b[i]){
	hit++;
	blow--;
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }
  return 0;
}

C++: #include <set>
#include <array>
#include <iostream>

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
  	blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size()) << std::endl;
    blowing.clear();
  }
return 0;
}

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

int main(void){
    int a[4];
    int b[4];
    
    while(1){
        int hitcount = 0;
        int bcount   = 0;
        
        for(int i = 0; i < 4; i++){
            if(!(cin >> a[i])) break; 
        }
        
        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<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

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

        int hi = 0, bl = 0;
        rep(i, 4){
            if(a[i] == b[i]){
                ++hi;
            }else{
                rep(j, 4){
                    if(i == j){
                        continue;
                    }
                    if(a[j] == b[i]){
                        ++bl;
                    }
                }
            }
        }

        cout << hi << " " << bl << endl;
    }

    cout << flush;

    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>


using namespace std;

int main(){
  vector<int> a(4,0), b(4,0);
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){

    int hit=0;
    int 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;
  }
}

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],
		cin >> 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;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x,y;
    cin >> a >> b >> c >> d;
    cin >> e >> f >> g >> h;
        if (a==e){x=x+1 ;e=e+10;} 
        if (b==f){x=x+1;f=f+10;} 
        if (c==g){x=x+1;g=g+10;}
        if (d==h){x=x+1;h=h+10;}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " <<  y << endl;
    
    
return 0 ;
}