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(void) {
	int a[4], b[4], e = 0, f = 0;
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		e = 0;
		f = 0;
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) e++;
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i != j) {
					if (a[i] == b[j]) {
						f++;
					}
				}
			}
		}
		cout << e << " " << f << 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] = 10 + hit;
				b[i] = 10 + hit;
			}
		}

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

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

	return 0;
}

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

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	  
	  int a;
	  while(cin>>a){
	  	vector<int> A;
		A.push_back(a);
		rep(i,3){
			int b;
			cin>>b;
			A.push_back(b);
		}
		
		vector<int> B;
		rep(i,4){
			int b;
			cin>>b;
			B.push_back(b);
		}
		
		int hit=0;
		int blow = 0;
		rep(i,4){
			rep(j,4){
				if(A[i]==B[j]){
					if(i==j)hit++;
					else blow++;
				}
				
			}
		}
		
		printf("%d %d\n",hit,blow);
	  }
	
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

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

	
	return 0;
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a[4];
	int b[4];
	while(cin >> a[0])
	{
		for(int i = 1; i < 4; ++i)
		{
			cin >> a[i];
		}
		for(int i = 0; i < 4; ++i)
		{
			cin >> b[i];
		}
		int hit = 0;
		int 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;
	}
}

int main()
{
	solve();
	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())-num << std::endl;
    blowing.clear();
  }
return 0;
}

C++: #include <iostream>
#include <algorithm>
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 hit=0, blow=0;
    bool checked[4][4]; for(int i=0;i<4;i++)for(int j=0;j<4;j++)checked[i][j]=false;
    
    for(int i = 0; i < 4; i++) {
      for(int j = 0; j < 4; j++) {
	if(checked[i][j]) continue;
	
	if(i == j && a[i] == b[j]) {
	  hit++;
	  checked[i][j] = true; checked[j][i] = true;
	}
	else if(a[i] == b[j]) {
	  blow++;
	  checked[i][j] = true; checked[j][i] = true;
	}
      }
    }

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

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

int main() {
	int a[4];
	int b[4];
	bool flag[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		int hitNumber = 0;
		int blowNumber = 0;
		for(int i = 0; i < 4; i++) flag[i] = false;
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				hitNumber++;
				flag[i] = true;
			}
		}
		for(int i = 0; i < 4; i++) {
			if(flag[i] == true) continue;
			else {
				for(int j = 0; j < 4; j++) {
					if(a[i] == b[j]) {
						blowNumber++;
					}
				}
			}
		}
		cout << hitNumber << " " << blowNumber << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int a[4],b[4];
    while (true)
    {
        if ( cin.eof() ) { break; }
        rep(j,4) cin>>a[j];
        rep(j,4) cin>>b[j];
        
        int hit=0,bl=0;
        rep(i,4){
            if(a[i]==b[i]) hit++;
            rep(j,4){
                if(a[i]==b[j]) bl++;
            }
        }
        cout<<hit<<" "<<bl-hit<<endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
    int a[4];
    int c[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>c[0]>>c[1]>>c[2]>>c[3]){
        int h=0,b=0;
        for(int i=0;i<4;i++){
            if(a[i]==c[i])
                h++;
            else{
                for(int j=0;j<4;j++){
                    if(a[i]==c[j]){
                        b++;
                        break;
                    }
                }
            }
        }
    }
    return 0;
}