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 k = 0;
	int a[4], b[4];
	int hitto[1000] = {0}, buro[1000] = {0};
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hitto[k]++;
			}
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j]){
					buro[k]++;
				}
			}
		}
		buro[k] = buro[k]-hitto[k];
		k++;
	}
	for(int i = 0; i < k; i++){
		cout << hitto[i] << " " << buro[i] << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    while(cin<<n){

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int w,x,y,z;
	int hit=0,blow=0;
	cin>>w>>x>>y>>z;
	if(w==a)hit++;
	else if(w==b||w==c||w==d)blow++;
	if(x==b)hit++;
	else if(x==a||x==c||x==d)blow++;
	if(y==c)hit++;
	else if(y==b||y==a||y==d)blow++;
	if(z==d)hit++;
	else if(z==b||z==c||z==a)blow++;
	cout<<hit<<" "<<blow<<endl;
    }


	return 0;
}

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

int main()
{
	string a,b;
	while(getline(cin,a))
	{
		getline(cin,b);
		int hit=0,blow=0;

		for (int i = 0; i < 7; ++i)
		{
			for (int j = 0; j < 7; ++j)
			{
				if(b[i]!=' '&&b[i]==a[j])
				{
					if(i==j) hit++;
					else blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
bool Init(int *a, int *b);


int main()
{
	int a[4], b[4];
	int cntHits, cntBlow;
	while (Init(a, b))
	{
		cntHits = cntBlow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]) ++cntHits;
		}
		for (int i = 0; i < 4; ++i)
		{
			for (int j = 0; j < 4; ++j)
			{
				if (i != j && a[i] == b[j]) ++cntBlow;
			}
		}
		cout << cntHits << " " << cntBlow << endl;
	}
	return 0;
}
bool Init(int *a, int *b)
{
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3])
	{
		return true;
	}
	return false;
}

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

int main(){
	int Hit , Blow ;
	char a[4],b[4];
	while(cin >> a >> b){
		Hit = 0 , Blow = 0;
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4 ; j++){
				if(a[i] == a[j]) Blow++;
			}
		}

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

		cout << Hit << " " << Blow << "\n";
	}

}

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

C++: #include <iostream>

using namespace std;

int main(){

	int A[5];
	int B[5];
	int k = 1;

	while(1){

		int hit = 0 , blow = 0;

		for(int i = 0; i < 4; i++){
			cin >> A[i];
		}

		for(int i = 0; i < 4; i++){
			cin >> B[i];
		}

		if(A[0] == 0 || A[1] == 0 || A[2] == 0 || A[3] == 0 ||
			B[0] == 0 || B[1] == 0 || B[2] == 0 || B[3] == 0) break;

		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] && A[i] != B[i]){
					blow++;
				}
			}
		}

		cout << hit << " " << blow << endl;
		k++;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
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];
    int x = 0,y = 0;
    for(int i=0; i<4; i++){
      if(a[i] == b[i]){
	x++;
	a[i] = b[i] = -1;
      }
    }
    for(int i=0; i<4; i++){
      if(b[i] == -1) continue;
      for(int j=0; j<4; j++){
	if(b[i] == a[j]){
	  a[j] = -1;
	  y++;
	  break;
	}
      }
    }
    cout <<x<<" "<<y<<endl;
  }
  return 0;
}

C++: #include<iostream>
 
 int main(){
    int a[4],b[4],hit,blow,i,j;
    while(std::cin>>a[0]){
    for(i=1;i<4;i++){
    std::cin>>a[i];
    }for(i=0;i<4;i++){
    std::cin>>b[i];
    }
    hit=0;
    blow=0;
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            if(i==j&&a[i]==b[j]){
            hit++;
            }if(i!=j&&a[i]==b[j]){
            blow++;
            }
        }
    }
    std::cout<<hit<<" "<<blow<<std::endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 50;
    for(int i = 0;i < 50;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] 
            >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i] ;
        
    } 
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

C++: #include <cstdio>

using namespace std;

int main()
{
	int a[4],b[4];
	while(scanf("%d",&a[0])!=EOF){
		scanf("%d %d %d",&a[1],&a[2],&a[3]);
		scanf("%d %d %d %d",&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++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

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

int main()
{
	int i,j;
	int a[4];
	int b[4];
	while(1){

		int hit =  0;
		int blow = 0;
		if(cin.eof())return 0;
		for(i=0;i<4;++i)cin>>a[i];
		for(i=0;i<4;++i)cin>>b[i];

		for(i=0;i<4;++i){
			for(j=0;j<4;++j){
				if(b[i] == a[j]){
					(j == i) ? ++hit : ++blow;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

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

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

int main(){
	int a[4], b[4];
	while(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";
	}
    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;
	}
}