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;

bool judgeZeroToNine(int n);
//bool judgeCorr(int n[]);

int main(){
	int a[4], b[4];
	do{
		cin >> a[0] >> a[1] >> a[2] >> a[3];
		while(!(judgeZeroToNine(a[0])&&judgeZeroToNine(a[1])&&
				judgeZeroToNine(a[2])&&judgeZeroToNine(a[3]))){
			cout << "wrong value\n";
			cin >> a[0] >> a[1] >> a[2] >> a[3];
		}
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		while(!(judgeZeroToNine(b[0])&&judgeZeroToNine(b[1])&&
				judgeZeroToNine(b[2])&&judgeZeroToNine(b[3]))){
			cout << "wrong value\n";
			cin >> 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])
					blow++;
			}
			if(a[i] == b[i]){
				blow--;
				hit++;
			}
		}
		cout << hit << " " << blow << "\n";
	}while(true);
    return 0;
}

bool judgeZeroToNine(int n){
	if((n >= 0)&&(n <= 9))
		return true;
	else
		return false;
}
/*
bool judgeCorr(int n[4]){
	for(int i = 0;i < 3;i++){
		for(int j = i + 1;j < 4;j++){
			if(n[i] == n[j])
				return true;
		}
	return false;
	}
}*/

C++: #include <iostream>
#include <cmath>
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 sum1 = 0, sum2 = 0;
        for (int i = 0; i < 4; ++i)
            if (a[i] == b[i])
                ++sum1;
        for (int i = 0; i < 4; ++i)
            for (int j = 0; j < 4; ++j)
                if (i != j && a[i] == b[j])
                    ++sum2;
        cout << sum1 << " " << sum2 << endl;
    }

    return 0;
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
typedef long long ll;

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

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

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

int main(void){

	int a[4],b[4];
	int hf,bf,hc,bc;

	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])!=EOF){
		hc=0,bc=0;
		for(int i=0;i<4;i++){
			hf=0,bf=0;
			for(int j=0;j<4;j++){
				if(a[i]==b[j]){
					bf=1;
					if(i==j){
						hf=1;
					}
				}
			}
			if(hf==1){
				hc++;
			}
			else if(bf==1){
				bc++;
			}
		}
		printf("%d %d\n",hc,bc);
	}
	return 0;
}

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, 4> A = {a1, a2, a3, a4};
		std::array<int, 4> 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++: /*AOJ 0025*/

#include<iostream>

using namespace std;

int Hit(int *a,int *b){
	int sum=0;

	for(int i=0;i<4;i++){
		if(a[i] == b[i]){
			sum++;
		}
	}

	return sum;
}

int Blow(int *a,int *b){

	int sum = 0;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(i==j){
				continue;
			}
			if(a[i] == b[j]){
				sum++;
				break;
			}
		}
	}

	return sum;
}

int main(){

	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];
		}

		cout<<Hit(a,b)<<" "<<Blow(a,b)<<endl;
	}

	return 0;
}

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

int main() {

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

  while(cin>>a[0]>>a[1]>>a[2]>>a[3]) {
    cin>>b[0]>>b[1]>>b[2]>>b[3];

    int h=0,k=0;
    for(int i=0; i<4; i++) {
      for(int j=0; j<4; j++) {
	if(a[i] == b[j]) {
	  if(i==j) h++;
	  else k++;
	}
      }
    }

    cout<<h<<" "<<k<<endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    int s;
    while (cin >> s) {
        int a[4];
        int b[4];
        a[0] = s;
        REP(i,3) cin >> a[i+1];
        REP(i,4) cin >> b[i];
        
        int hit = 0;
        REP(i,4) {
            if (a[i] == b[i]) hit++;
        }
        
        int blow = 0;
        REP(i,4) {
            if (find(begin(a), end(a), b[i]) != end(a)) blow++;
        }
        
        cout << hit << " " << blow - hit;
    }
    return 0;
}

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

int main(){
    std::array<int, 4> a; //player A
    std::array<int, 4> b; //player B
    int hit=0;
    int blow=0;
   
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        std::cin >> b[0] >> b[1] >> b[2] >> b[3];      
        //if(a[0] == a[1] == a[2] == a[3] == b[0] == b[1] == b[2] == b[3] == -1)
	//break;

	//    std::cout << b[0];
    
        for(int i=0; i<a.size(); ++i){
            for(int j=0; j<b.size(); ++j){
	        if(a[i] == b[j] && i == j)
	            ++hit;
	        else if(a[i] == b[j] && i != j)
	            ++blow;
	    }
	}

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

	hit = blow = 0;
    }  
    return 0;
}

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

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

int main(){
    int runs =0;
    int i,j;
    int hits=0;
    int blows=0;
    int player1[4]; 
    int player2[4]; 
	while(4==scanf("%d %d %d %d", &player1[0],&player1[1],&player1[2],&player1[3])){
	    
	    scanf("%d %d %d %d", &player2[0],&player2[1],&player2[2],&player2[3]);
	    hits=0;
	    blows=0;
	    for(i=0;i<4;i++){
	        if(player1[i]==player2[i]) hits++;
	        for(j=i;j<4;j++){
	            if(player1[i]==player2[j]) blows++;
	        }
	    }
	    blows-=hits;
	    if(runs!=0) printf("\n");
	    runs++;
	    printf("%d %d",hits,blows);
	}  
	return 0;
}