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 <vector>
#include <algorithm>
 
int main(){
    std::vector<int> a(4);
     
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
         
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
             
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i) ++hit;
            else if(it != a.end()) ++blow;
        }
         
        std::cout << hit << " " << blow << std::endl;
         
    }
     
    return 0;

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

int main(void){
	std::array <int, 4> ansA;
	std::array <int, 4> ansB;

	while(std::cin >> ansA[0] >> ansA[1] >> ansA[2] >> ansA[3] >> ansB[0] >> ansB[1] >> ansB[2] >> ansB[3]){
		int hit = 0; //count hit
		int blow = 0; //count blow

		for(size_t i = 0; i < ansA.size(); ++i){ //judgment hit and blow
			for(size_t j = 0; j < ansB.size(); ++j){
				if(ansA[i] == ansB[j] && i == j){
					++hit;
				}else if(ansA[i] == ansB[j] && i != j){
					++blow;
				}
			}
		}

		std::cout << hit << " " << blow << std::endl; //output result
	}

	return 0;
}

C++: #include <iostream>
int main(){
    int n;
    while(std::cin>>n){
        if(n==0){
            break;
        }
        else{
            int a[4];
            a[0]=n;
            for(int i=1;i<4;++i){
                std::cin>>a[i];
            }
            int b[4];
            for(int i=0;i<4;++i){
                std::cin>>b[i];
            }
            int c=0,d=0;
            for(int i=0;i<4;++i){
                for(int j=0;j<4;++j){
                    if(a[i]==b[j]){
                        if(i==j){
                            ++c;
                        }
                        else{
                            ++d;
                        }
                    }
                }
            }
            std::cout<<c<<" "<<d<<std::endl;
        }
    }
    return 0;
}

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

				
int main(){
	std::vector<int> a,b;
	a.resize(4);
	b.resize(4);
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		int hit = 0;
		int blow = 0;
		for(int i = 0; i <= 3; ++i){
			if(a.at(i) == b.at(i))
				++hit;
		}
		for(int i = 0; i <= 3; ++i){
			for(int j = 0; j <= 3; ++j){
				if(a.at(i) == b.at(j))
					++blow;
			}
		}
		
		std::cout << hit << " " << blow - hit << std::endl;
	}
	
	return 0;
}

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

C++: #include<iostream>
using namespace std;
int main()
{
	int blow,hit;
	int a[4];
	int b[4];
while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3])
{	
	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(a[j]==b[i]&&j!=i)
			{
			blow++;
			}
		}
	}
	cout<<hit<<" "<<blow<<endl;
}
return 0;
}

C++: #include <iostream>

#define SIZE 4

using namespace std;

int main() {
	int a[SIZE], b[SIZE], hit, blo;

	while (cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]) {
		hit = 0;
		blo = 0;
		for (int i = 0; i < SIZE; i++) {
			if (a[i] == b[i]) {
				hit++;
				a[i] = -1;
				b[i] = -1;
			}
		}

		for (int i = 0; i < SIZE; i++) {
			for (int j = i + 1; j < SIZE; j++) {
				if (a[i] == -1 || b[j] == -1) {
					continue;
				}

				if (a[i] == b[j]) {
					a[i] = -1;
					b[j] = -1;
					blo++;
				}
			}
		}
		cout << hit << " " << blo << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <sstream>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define SIZE 300005
#define INF INT_MAX / 3
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<=(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());
#define SQ(x) ((x)*(x))

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;

/////

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int T[8];
  vector<int> a(4);
  vector<int> b(4);
  int i = 0;
  while(cin >> T[i])
  {
    i = (i+1)%8;
    if(i == 0)
    {
      REP(i,4) a[i] = T[i];
      REP(i,4) b[i] = T[i+4];
      int hit = 0, blow = 0;
      REP(i,4) hit += (a[i] == b[i]);
      REP(i,4) blow += (find(ALL(b),a[i])!=b.end());
      cout << hit << " " << blow-hit << endl;
    }
  }

}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	while (1){
	vector<int> a(4);
	vector<int> b(4);
	int hit_count=0;
	int blow_count=0;
	REP(i,4){
		cin>>a[i];
	}
	REP(i, 4){
		cin >> b[i];
	}
	REP(i, 4){
		if (a[i] == b[i]){
			hit_count++;
		}
	}
	REP(i, 4){
		REP(j, 4){
			if (i==j)continue;
			if (a[i] == b[j]){
				blow_count++;
			}
		}
	}
	cout << hit_count << " "<<blow_count<<endl;
	}
}