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], c, d;
  while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
    c = d = 0;
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++)
        if (a[i] == b[j]) (i == j) ? c++ : d++;
    cout << c << ' ' << d << endl;
  }
}

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

int main(void){
  int a[4]={0},b[4]={0},Hit=0,Blow=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] && i == j ) Hit++;
      else if( a[i] == b[j] && i != j ) Blow++;

    }
  }

  cout << Hit <<" "<< Blow << endl;

  return 0;
}

C++: #include<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow;
	double stoped;
	
	

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

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

		for(i=0;i<4;i++){		//hit
			if(a[i]==b[i]){
				hit++;
			}
		}
	
		for(i=0;i<4;i++){		//brrow
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					brrow++;
				}
			}
		}	
		printf("%d %d\n",hit,brrow);
	
	return 0;
}

C++: #include <stdio.h>

int main(void) {

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

  int hit,blow;

  int i,j;
  char c;

  while(1) { 
   
    if(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==EOF || scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3])==EOF) break;

    //fflush(stdin);
    hit=blow=0;
    
    for(i=0;i<4;i++) {
       
      for(j=0;j<4;j++) {

	if(a[i]==b[j]) {

	  if(i==j) hit++;
	  else blow++;

	}
	  
      }

    }

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

  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a[4],b[4],flg[4];
	int i,j;
	int hit,blow;
	
	while(1){
		cin>>a[0];
		if(cin.eof()==1)	break;
		for(i=1;i<4;i++){
			cin>>a[i];
			flg[i]=0;
		}
		for(i=0;i<4;i++)	cin>>b[i];
		hit=0;
		blow=0;
		for(i=0;i<4;i++){
			if(a[i]==b[i]){
				hit++;
				flg[i]=1;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(i!=j||flg[j]==0){
					if(a[i]==b[j])	blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);}

C++: #include <iostream>
#include <set>
using namespace std;
int main() {
	string a, b;
	set<int> aa, bb;
	while (getline(cin, a) && getline(cin, b)) {
		int hit = 0;
		int blow = 0;
		for (int i = 0; i != a.size(); i += 2) {
			if (a[i] == b[i]) {
				++hit;
			}
			else {
				aa.insert(a[i]-'0');
				bb.insert(b[i]-'0');
			}
		}
		for (int i = 1; i <= 9; ++i) {
			if (aa.count(i) && bb.count(i)) {
				++blow;
			}
		}
		cout << hit << " " << blow << endl;
		aa.clear();
		bb.clear();
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int a[4],b[4];
  while(~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3)){
    int hit = 0;
    REP(i,4)if(a[i]==b[i])++hit;
    sort(a,a+4);
    sort(b,b+4);
    int blow = -hit;
    REP(i,4)if(a[i]==b[i])++blow;
    printf("%d %d\n",hit,blow);
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
int a[4];
int b[4];
int c;
int d;
int e;
int f;
while(cin >>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
e=0;
f=0;
c=0;
while(c<4){
d=0;
while(d<4){
if(a[c]==b[d]){if(c==d){e=e+1;} else{f=f+1;}}
d=d+1;}
c=c+1;}
cout <<e<<" "<<f<<endl;
}}

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

C++: import Control.Monad
import Control.Applicative
import Data.List

main = do
  xs <- input $ map read . words :: IO [[Int]]
  mapM_ putStrLn $ solve xs
  
solve :: [[Int]] -> [String]
solve [] = []
solve (xs:ys:yss) = (show h ++ " " ++ show b) : solve yss
  where h = hit xs ys
        b = smn xs ys - h

hit :: [Int] -> [Int] -> Int
hit xs ys = sum $ zipWith (\x y -> if x == y then 1 else 0) xs ys

smn :: [Int] -> [Int] -> Int
smn xs ys = foldl f 0 ys
  where
    f :: Int -> Int -> Int
    f acc z = if z `elem` xs then acc + 1 else acc

input :: (String -> a) -> IO [a]
input f = map f . lines <$> getContents

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

int main(){
    int array[4][2] = {0};
    int hit = 0;
    int blow = 0;
    while (cin>>array[0][0]>>array[1][0]>>array[2][0]>>array[3][0]){
        cin >> array[0][1]>>array[1][1]>>array[2][1]>>array[3][1];
        hit = 0;
        blow = 0;
        for (int i = 0; i < 4; i++){
            if (array[i][0] == array[i][1]) {
                hit++;
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = i; j < 4; j++) {
                if (array[i][0] == array[j][1]) {
                    if (array[i][0] != array[i][1]) {
                        blow++;
                    }
                }
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

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

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> 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[i]==b[j]) blow++;
			}
		}
		std::cout << hit << " " << blow-hit << std::endl;
	}

    return 0;
}

C++: #include <iostream>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;

int main(){
    int a[4], b[4];
    while(1){
        if(cin.eof()) break;
        rep(i, 0, 4) cin >> a[i];
        rep(i, 0, 4) cin >> b[i];
        bool f[4];
        rep(i, 0, 4) f[i] = false;
        int hit = 0, blow = 0;
        rep(i, 0, 4){
            if(a[i] == b[i]){
                hit++; f[i] = true;
            }
        }
        rep(i, 0, 4){
            if(f[i]) continue;
            rep(j, 0, 4){
                if(a[i] == b[j]) blow++;
            }
        }
        cout << hit << " " << blow << endl;
    }
}