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 <array>

int main(){

	std::array<int, 4> num_a, num;

	std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3];

	while(std::cin >> num[0] >> num[1] >> num[2] >> num[3]){
		int hit = 0, blow = 0;
		for(std::size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include <stdio.h>
int main(){
    int a[4],b[4],x,y;
    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){
        x=y=0;
        for(int i=0;i<4;i++){
            if(a[i]==b[i])x++;
            else if(a[i]==b[(i+1)%4]||a[i]==b[(i+2)%4]||a[i]==b[(i+3)%4])y++;
            
        }
        printf("%d %d\n",x,y);
    }}

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

C++: #include<stdio.h>

int main()
{
	int a[4],b[4],hit,brow;

	while(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]);
		hit=0;
		brow=0;

		if(a[0]>9||a[1]>9||a[2]>9||a[3]>9||b[0]>9||b[1]>9||b[2]>9||b[3]>9)
		{
		}
		else 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)
		{
		}
		else
		{
			for(int x=0;x<4;x++)
			{
				for(int y=0;y<4;y++)
				{
					if(a[x]==b[y])
					{
						if(x==y)
						{
							hit++;
						}
						else
						{
							brow++;
						}
					}
				}
			}
			printf("%d %d\n",hit,brow);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef vector<int> vi;

int hit(vi a,vi b){
  int res = 0;
  rep(i,4) if(a[i] == b[i]) res++;
  return res;
}

int blow(vi a,vi b){
  int res = 0;
  rep(i,4) rep(j,4) if(i != j && a[i] == b[j]){
    res++;
    break;
  }
  return res;
}

int main(){
  vi a(4),b(4);
  while(1){
    rep(i,4) if(!(cin>>a[i])) return 0;
    rep(i,4) cin>>b[i];
    cout<<hit(a,b)<<" "<<blow(a,b)<<endl;
  }
}

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

int main() {
  while(!cin.eof()) {
    int A[4],B[4];
    int hit = 0;
    int blow = 0;
    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++;
    }
    for(int i=0;i<4;i++) {
      for(int j=0;j<4;j++) {
        if(A[i] == B[j]) {
          blow++;
          break;
        }
      }
    }
    blow = blow - hit;
    cout << hit << " " << blow << endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
	int a[4];
	int b[4];
	int i,j;
	int hit,blow;
	while(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]);
		hit=0;
		blow=0;
		for(i=0;i<4;i++){
			if(a[i]==b[i]){
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					blow++;
				}
			}
		}
		blow=blow-hit;
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
        const int MAX = 4;
        int a[MAX], b[MAX];

        while (true) {
                for (int i = 0; i < MAX; i++) {
                        if (!(cin >> a[i])){
                                return 0;
                        }
                }
                for (int i = 0; i < MAX; i++) {
                        cin >> b[i];
                }
                int hit = 0, blow = 0;
                for (int i = 0; i < MAX; i++) {
                        if (a[i] == b[i]) {
                                hit++;
                        }
                        for (int j = 0; j < MAX; j++) {
                                if (i != j && a[i] == b[j]) {
                                        blow++;
                                }
                        }
                }
                cout << hit << " " << blow << endl;
        }

        return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int num1,num2;
    int a[5],b[5];
    while(~scanf("%d",&a[1])){
          for(int i=2;i<=4;i++){
            scanf("%d",&a[i]);
          }
          for(int i=1;i<5;i++){
            scanf("%d",&b[i]);
          }
          num1=0;
          num2=0;
          for(int i=1;i<=4;i++){
            if(a[i]==b[i]) num1++;
            for(int j=0;j<=4;j++){
                if(i!=j){
                    if(a[i]==b[j]) num2++;
                }
            }
          }
          printf("%d %d\n",num1,num2);

    }
return 0;
}

C++: #include <cstdio>

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

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

int main(void)
{
	int a[4],b[4];

	while(cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()){
		cin >> b[0] >> b[1] >> b[2] >> b[3];

		int hit = 0, blow = 0;
		int num[10] = {};

		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				b[i] = 0;
			}
			num[a[i]]++;
		}
		for(int i = 0; i < 4; i++)
			if(num[b[i]] > 0)
				blow++;
		

		cout << hit << ' ' << blow << endl;
	}



	return 0;
}

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

int main() {
    int o;
     while(cin>>o){
	int d[3],c[3],y,g=0,b=0;
    d[0]=o;
    for(int i=1;i<8;i++){
       cin>>y;
       if(i<4){
           d[i]=y;
        }
       else{
          c[i]=y;
       }
     }

    for(int j=0;j<4;j++){
     if(d[j]==c[j]){
       g++;
      }
      for(int k=0;k<4;k++){
         if(d[j]==c[k] &&  j!=k){
            b++;
         }
       }
     }
     cout<<g<<" "<<b<<endl;
    }
    
	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;
				
			blow += std::count(A.begin(), A.end(), B[i]);

		}

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

		return 0;

}

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

using std::cin;

int main()
{
    std::array<int, 4> a, b;
    while (cin >> a.at(0)) {
        for (auto i = 1; i < 4; i++) {
            cin >> a.at(i);
        }
        for (auto i = 0; i < 4; i++) {
            cin >> b.at(i);
        }

        int hit = 0, blow = 0;
        for (auto i = 0; i < 4; i++) {
            for (auto j = 0; j < 4; j++) {
                if (a.at(i) == b.at(j)) {
                    if (i == j) {
                        hit++;
                    } else {
                        blow++;
                    }
                }
            }
        }

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

    return 0;
}