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>
#include <vector>
using namespace std;

int main() {
	vector<int> a(4), b(4);
	while(!cin.eof()){
		for( int i=0; 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 ){
			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;

#define M 4
int a[M], b[M];

double sub_in(int a[], int n)
{
	for (int i = 0; i < n; i++)
	{
		if (!(cin >> a[i]))
			return false;
	}
	return true;
}

bool in_ab(int a[], int b[], int n)
{
	if (!sub_in(a, n) || !sub_in(b, n))
		return false;
	return true;
}

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

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

int main()
{
	while (in_ab(a,b,M))
	{
		cout << hit(a,b,M) << " " << blow(a,b,M) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

vector<char> a(4),b(4);

int main(){
	char c,d,e,f;
	while(cin>>c>>d>>e>>f>>g>>h>>d>>k){
		int hit=0,blow=0;
		a={c,d,e,f};
		b={g,h,d,k};
//		for(int i=0;i<4;i++) cin>>b[i];
		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) continue;
				if(a[i]==b[j]) blow++;
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;





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

C++: #include <iostream>

using namespace std;

int main()
{
	int numA[4], numB[4], tmpA[4], tmpB[4], hit=0, blow=0;
	
	cin >> numA[0] >> numA[1] >> numA[2] >> numA[3];
	cin >> numB[0] >> numB[1] >> numB[2] >> numB[3];
	
	while (1) {
		hit = 0; blow = 0;
		cin >> tmpA[0] >> tmpA[1] >> tmpA[2] >> tmpA[3];
		for (int i=0; i<4; i++)
			if (tmpA[i] == numB[i])
				hit++;
		for (int i=0; i<4; i++)
			for (int j=0; j<4; j++)
				if (i != j && tmpA[i] == numB[j])
					blow++;
		cout << hit << " " << blow << endl;
		
		hit = 0; blow = 0;
		cin >> tmpB[0] >> tmpB[1] >> tmpB[2] >> tmpB[3];
		for (int i=0; i<4; i++)
			if (tmpB[i] == numA[i])
				hit++;
		for (int i=0; i<4; i++)
			for (int j=0; j<4; j++)
				if (i != j && tmpB[i] == numA[j])
					blow++;
		
		cout << hit << " " << blow << endl;
		if (cin.eof()) break;
	}
	return 0;
}

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

int main(void)
{
	int n, hit = 0 , blow = 0;
	int num1[4], num2[4];
	while(scanf("%d",&num1[0]) != EOF){
		hit = 0;
		blow = 0;
		for(int f1 = 1; f1 < 4; f1++)
		{
			scanf("%d", &num1[f1]);
		}
		for(int f1 = 0; f1 < 4; f1++)
		{
			scanf("%d", &num2[f1]);
		}
		for(int f1 = 0; f1 < 4; f1++)
		{
			if(num1[f1] == num2[f1])
			{
				hit++;
			}
			else
			{
				for(int f2 = 0; f2 < 4; f2++)
				{
					if(num1[f1] == num2[f2])
					{
						blow++;
						break;
					}
				}
			}
		}
	printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

int main(void){
  int a[4],b[4],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 <iostream>
#include <cstdio>
using namespace std;
int main(){
	int a[4],b[4];
	while(1){
		if(not (cin >> a[0] >> a[1] >> a[2] >> a[3])) break;
		if(not (cin >> b[0] >> b[1] >> b[2] >> b[3])) break;
		int hit = 0;
		int blow = 0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
			for(int j=1;j<=3;j++) if(a[i]==b[(i+j)%4]) blow++;
		}
		cout << hit << " " <<  blow << 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++){
            for(int j = 0; j < 4; j++){
                if(a[i] == b[j]){
                    if(i == j){
                        hit++;
                    }else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	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 count = 0;
		for( int i = 0;i < 4;i++ ){
			if( a[i] == b[i] ){ count++; a[i] = b[i] = -1; }
		}
		cout << count;

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

		cout << " " << count << endl;
	}



	return 0;
}

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

using namespace std;

int main(){

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

	return 0;
}