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 <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

int main() {
	vci a(4), b(4);
	bool use[10] = { 0 };
	
	while (~scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3])) {		
		for_(i, 0, 4) use[ a[i] ] = 1;
		
		int hit = 0, blow = 0;
		for_(i, 0, 4) {
			if (a[i] == b[i]) hit++;
			else if (use[ b[i] ]) blow++;
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int ss[8],i,j;
	int ans[2];
	
	for(;cin >> ss[0];)
	{
		ans[0]=ans[1]=0;
		
		for(i=1;i<8;i++)
			cin >> ss[i] ;
		
		for(i=0;i<4;i++)
		{
			if(ss[i]==ss[i+4])
			{
				ans[0]++;
				ss[i+4]=-1;
			}
		}
		for(i=0;i<4;i++)
			for(j=4;j<8;j++)
				if(ss[i]==ss[j])
					ans[1]++;
		
		cout << ans[0] << " " << ans[1] << endl;
	}
}

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

int main(){

	int a1, a2, a3, a4, b1, b2, b3, b4;

	while(std::cin >> a1 >> a2 >> a3 >> a4){
		
		std::cin >> b1 >>b2 >> b3 >>b4;

		std::array<int> A = {a1, a2, a3, a4};
		std::array<int> B = {b1, b2, b3, b4};
		
		int hit = 0;
		int blow = 0;

		for(int i = 0; i < 4; ++i){
			
			if(A[i] == B[i])
				hit++;
				
			count += std::count(A.begin(), A.end(), B[i]);

		}

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

		return 0;

}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

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

int main() {
	while (cin >> a[0]) {
		rep(i, 3) {
			cin >> a[i+1];
		}
		rep(i, 4) {
			cin >> b[i];
		}
		int hit_n = 0;
		rep(i, 4) {
			if (a[i] == b[i]) hit_n++;
		}
		int blow_n = 0;
		rep(i, 4) rep(j, 4) {
			if (i == j) continue;
			if (a[i] == b[j]) blow_n++;
		}
		cout << hit_n << " " << blow_n << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int n = 0;
	while (cin >> n) {
		int a[4], b[4];
		int hit = 0, blow = 0;
		a[0] = n;
		cin >> a[1] >> a[2] >> a[3];
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (i == j && a[i] == b[i]) {
					++hit;
				}
				else if (a[j] == b[i]) {
					++blow;
				}
			}
		}
		cout << hit << blow << endl;
	}
}

C++: #include<stdio.h>
int main(){
  int i=0;
  int data[4];
  while(scanf("%d",&data[i])!=EOF){
    int i,j,hit=0,blow=0;
    int str[4]={0};
    for(i=1;i<4;i++){
      scanf("%d",&data[i]);
    }
    for(i=0;i<4;i++){
      scanf("%d",&str[i]);
    }
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(data[i]==str[j]){
	  if(data[j]==str[j]){
	    hit++;
	  } else{
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }
  return(0);
}

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

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

	while(cin >> a[0] >> a[1] >> a[2] >> a[4])
	{
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		count = 0;
		count_2 = 0;

		for(int i=0;i<4;i++)
		{
			for(int j=0;j<4;j++)
			{
				if(a[i] == b[j])
				{
					if(i == j)
					{
						count++;
					}
					else
					{
						count_2++;
					}
				}
			}
		}
		cout << count << " " << count_2 << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

int bucket[10];
int a[4], b, hit, blow;

int main()
{
	
	while(1)
	{
		if( cin.eof() )
			break;
		
		memset(bucket, 0, sizeof(bucket));
		hit = 0; blow = 0;
		
		for(int i = 0; i < 4; i++)
		{
			cin >> a[i];
			bucket[a[i]] = 1;
		}
		
		for(int i = 0; i < 4; i++)
		{
			cin >> b;
			if( b == a[i] )
				hit++;
			else if( bucket[b] )
				blow++;
		}
		
		cout << hit << " " << blow << endl;	
		
	}
	
	return 0;
}

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

using namespace std;

void check_num(array<int,8> a){
  int hit_num=0,blow_num=0;
  for(int i=0;i<4;i++){
    for(int j = 4;j<8;j++){
      if(a[i] == a[j]){
        if(j-4 == i){
          ++hit_num;
        }else{
          ++blow_num;
        }
      }
    }
  }

  cout<<hit_num<<" "<<blow_num<<endl;
}

int main(void){
  array<int,8> a; //プレイヤーa,bの値
  int input;

  while(cin >> input){
    a[0]=input;
    for(int i = 1;i<8;i++){
      cin >>a[i];
    }
    check_num(a);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int a[4];
	int b[4];
	int hit=0;
	int blow=0;
	int m, n;

	for(int i=0; i<4; i++){
		cin >> a[i];
	}
	for(int i=0; i<4; i++){
		cin >> b[i];
	}
	for(m=0; m<4; m++){
		for(n=0; n<4; n++){
			if(a[m] == b[n] && m == n){
				hit = hit + 1;
			}
			else if(a[m] == b[n]){
				blow = blow + 1;
			}
		}
	}
		
	cout << hit << " " << blow << endl;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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