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 hit(int a[],int b[]);
int blow(int a[], int b[]);
int main(){
    int a[4];
    int b[4];
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
        if (cin.eof()){break;}
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

int hit(int a[],int b[]){
    int n=0;
    for (int i=0; i<4;i++){
        if (a[i]==b[i])
            n++;
    }
    return n;
}

int blow(int a[], int b[]){
    int n=0;
    for (int i=0; i<4; i++){
        for (int j=0; j<4; j++){
            if (a[i]==b[j])
                n++;
        }
    }
    n -= hit(a,b);
    return n;
}

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

int main(){

	std::array<int, 4> num_a, num;

	while(std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3]){
		std::cin >> num[0] >> num[1] >> num[2] >> num[3];
		int hit = 0, blow = 0;
		for(std::size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(std::size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int main() {
	for(vector<int> a(4), b(4); cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3];) {
		int hit = 0, blow = 0;
		rep(i,4) {
			if(a[i] == b[i])
				hit++;
			else {
				if(EXIST(a, b[i])) {
					blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int> a(4);
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
		vector<int> b(4);
		cin>>b[0]>>b[1]>>b[2]>>b[3];
		int h=0,bl=0;
		for(int i=0;i<4;++i){
			if(b[i]==a[i]) ++h;
			else if(find(a.begin(),a.end(),b[i])!=a.end()) ++bl;
		}
		cout << h << " " << bl << endl;
	}
	return 0;
}

C++: #include <iostream>

int main(int argc, char **argv)
{
	while(true){
		int a[4];
		int b[4];
		std::cin >> a[0] >> a[1] >> a[2] >> a[3];
		std::cin >> 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++;
			}else{
				for(int j = 0; j < 4; j++){
					if(a[i] == b[j]){
						blow++;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}
	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int main(void){
    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;
    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++;
            }
        }
    }
    cout << hit << " " << blow << endl; 
  }
}

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

int main() {
     while(1){
	int d[3],c[3],y,g=0,b=0;
    
    for(int i=0;i<8;i++){
       cin>>y;
       if(i<4){
           d[i]=y;
        }
       else{
          c[i]=y;
       }
     }

    for(int j=0;j<4;j++){
     if(d[j]==c[j]){
       g++;
      }
      for(int k=0;k<4;k++){
         if(d[j]==c[k] &&  j!=k){
            b++;
         }
       }
     }
     cout<<g<<" "<<b<<endl;
    }
    
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <set>
using namespace std;

int main(){

    int a[4], b, h, bl;
    while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF) {
        set<int> s;
        h = bl = 0;
        for (int i = 0; i < 4; i++) s.insert(a[i]);
        for (int i = 0; i < 4; i++) {
            scanf("%d", &b);
            if (a[i] == b) h++;
            else if (s.find(b) != s.end()) bl++;
        }
        printf("%d %d\n", h, bl);
    }
    return 0;
}

C++: #include<stdio.h>

int main(){
    /*    int m[10];
    int i,j,k;

    for(i = 0; i < 10; i++){
        scanf("%d",&m[i]);
    }

    for(j = 0; j < 9; j++){
        for(k = 0; k < 9-j; k++){
            if(m[k] < m[k+1]){
                int num = m[k+1];
                m[k+1] = m[k];
                m[k] = num;
            }
        }
    }

    for(i = 0; i < 3; i++){
        printf("%d\n",m[i]);
    }
    */

    int x[4],y[4];
    int i,j;
    int hit = 0,blow = 0;

    for(i = 0; i < 4; i++){
        scanf("%d",&x[i]);
    }
    for(i = 0; i < 4; i++){
        scanf("%d", &y[i]);
    }

    for(i = 0; i < 4; i++){
        if(x[i] == y[i]){
            hit++;
        }
    }
    for(i = 0; i < 4; i++){
        for(j = 0; j < 4; j++){
            if(x[i] == y[j] && i != j){
                blow++;
            }
        }
    }

    printf("%d %d",hit,blow);

    return 0;
}

C++: #include <iostream>

int main() {
	const int size = 4;
	int a[size], b[size];

	while (std::cin
		>> a[0] >> a[1] >> a[2] >> a[3]
		>> b[0] >> b[1] >> b[2]	>> b[3]
	) {
		int hit = 0, blow = 0;
		for (int i = 0; i < size; i++)
			if (a[i] == b[i]) {
				hit++;
			} else {
				for (int j = 1; j < size; j++)
					if (a[i] == b[j])
						blow++;
			}

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