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],b[4],hit=0,bro=0;
	for(int i=0;i<4;i++)	cin >> a[i];
	for(int i=0;i<4;i++)	cin >> b[i];
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(a[i]==b[j]){
				if(i==j)	hit++;
				else	bro++;
			}
		}
	}
	cout << hit << ' ' << bro << endl; 
}

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

int main(){
	std::array(u_int, 4) a, b;
	int hit=0, blow=0;

	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++;
			for(int j=0;j<4;j++){
				if(a[i]==b[j]) blow++;
			}
		}
		cout << hit << blow-hit << std::endl;
	}

    return 0;
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	int map[4];
	bool used[10];
	while(1) {
		bool eof = false;
		for(int i=0; i < 10; ++i) used[i] = false;
		for(int i=0; i < 4; ++i) {
			if(cin >> map[i]) {
				used[map[i]] = true;
			}
			else	{ eof = true; break; }
		}
		if(eof) break;
		int hit, br;
		hit = br = 0;
		for(int i=0; i < 4; ++i) {
			int inNum;
			cin >> inNum;
			if		(map[i] == inNum) ++hit;
			else if	(used[inNum]) ++br;
		}
		cout << hit << ' ' << br << endl;
	}
	return 0;
}

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]>> b[0] >> b[1] >> b[2] >> b[3]){
		
		h=0;
		br=0;
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		
		cout << h << ' '<< br << 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 hit=0,blow=0;
    for(int i=0;i<4;i++){
      if(a[i]==b[i])
        hit++;
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j);
        else{
          if(a[i]==b[j])
            blow++;
        }
      }
    }
  cout << hit << " " << blow << endl;  
  }
}

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

int get_hit(std::vector<u_int> *A, std::vector<u_int> *B)
{
    u_int hit = 0;
    for(u_int i = 0; i < A -> size(); ++i)
        if(A -> at(i) == B -> at(i))
            ++hit;
            
    return hit;
}

int get_blow(std::vector<u_int> *A, std::vector<u_int> *B)
{
    u_int blow = 0;
    for(u_int i = 0; i < A -> size(); ++i){
        for(u_int j = 0; j < B -> size(); ++j){
            if(A -> at(i) == B -> at(j)){
                if(i != j)
                    ++blow;
                break;
            }
        }
    }
            
    return blow;
}

int main()
{
    const u_int number = 4;
    std::vector<u_int> A;
    std::vector<u_int> B;
    A.reserve(number);
    B.reserve(number);
    
    u_int num1, num2, num3, num4;
    bool flag = true;
    while(std::cin >> num1 >> num2 >> num3 >> num4){
        if(flag){
            A.clear();
            B.clear();
            A.push_back(num1);
            A.push_back(num2);
            A.push_back(num3);
            A.push_back(num4);
            flag = !flag;
        }else{
            B.push_back(num1);
            B.push_back(num2);
            B.push_back(num3);
            B.push_back(num4);
            std::cout << get_hit(&A, &B) << " " << get_blow(&A, &B) << std::endl;
            flag = !flag;
        }
    }
        
    return 0;
}

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

int main(){
	std::array<u_int, 4> a,b;

	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 < 4; ++i){
			if(a[i] == b[i])
				hit++;

			if(a[i] == b[(i + 1) % 4] || a[i] == b[(i + 2) % 4] || a[i] == b[(i + 3) % 4])
				blow++;
		}

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

	return 0;
}

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

using namespace std;

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

C++: #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int a[4],b[4];
    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))
    {
        int x=0,y=0;
        for(int i=0;i<4;++i)
        if(a[i]==b[i])++x;
        else if(a[i]<b[i])++y;
        printf("%d %d\n",x,y);
    }
    return 0;
}

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

using namespace std;

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

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;
int main() {
  int a[4], b[4];
  while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    int ansb = 0, ansh = 0;
    rep(i, 4) cin >> b[i];
    rep(i, 4) rep(j, 4) {
      if (a[i] == b[j]) {
        if (i == j)
          ansh++;
        else
          ansb++;
      }
    }
    cout << ansh << ' ' << ansb << endl;
  }
  return 0;
}

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

int main() {
  while(true) {
    int A[4],B[4];
    int hit = 0;
    int blow = 0;
    cin >> A[0] >> A[1] >> A[2] >> A[3];
    if(cin.eof()) break;
    cin >> B[0] >> B[1] >> B[2] >> B[3];
    for(int i=0;i<4;i++) {
      if(A[i] == B[i])
        hit++;
    }
    for(int i=0;i<4;i++) {
      for(int j=0;j<4;j++) {
        if(A[i] == B[j]) {
          blow++;
          break;
        }
      }
    }
    blow = blow - hit;
    cout << hit << " " << blow << endl;
  }
}