Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

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

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

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

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int s[4];
int t[4];

int main(){
	ios::sync_with_stdio(false);
	do{
		REP(i,4){
			if (!(cin>>s[i])){
				return 0;
			}
		}
		REP(i,4){
			cin>>t[i];
		}
		int h=0,b=0;
		REP(i,4){
			REP(j,4){
				if (s[i]==t[j]){
					if (i==j){
						h++;
					}
					else{
						b++;
					}
				}
			}
		}
		cout<<h<<" "<<b<<endl;
	}while (1);
	return 0;
}

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

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

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

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
  	blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size()) << std::endl;
    blowing.clear();
  }
return 0;
}