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

int main() {
  const int N = 4;
  int a[N], b[N];
  while(cin >> a[0]) {
    for(int i = 1; i < N; ++i) cin >> a[i];
    for(int i = 0; i < N; ++i) cin >> b[i];
    int hit, blow;
    hit = blow = 0;
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < N; ++j) {
	if(a[i] == b[j]) {
	  if(i == j) ++hit;
	  else ++blow;
	}
      }
    }
    cout << hit << " " << blow << endl;
  }
  return 0;
}

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

using namespace std;

int main(){

	int a[4];
	int b[4];
	while(1){
		if(cin.eof())
			break;

		for(int i = 0; i < 4; i++)
			cin>>a[i];
		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],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 hit = 0,brow = 0;
    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]){
	  brow++;
	}
      }
    }
    cout << hit << ' ' << brow - hit << endl;
  }
}

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

int main() 
{
  int a[4];
  int b[4];
  int brow, hit;
  while(cin>> a[0] >> a[1] >> a[2] >>a[3] >> b[0] >> b[1] >> b[2] >> b[3])
  {
    hit = brow = 0;
    for(int i = 0; i < 4; i  )
    {
      for(int j = 0; j < 4; j  )
      {
        if(a[i] == b[j])
        {
          brow  ;
          break;
        }
      }
    }
    for(int i = 0; i < 4; i  )
    {
      if(a[i] == b[i])
      {
        hit  ;
      }
    }
    cout << hit << " " << brow - hit << endl;
  }
  return 0;
}

C++: #include <iostream>

int main() {
	int a[4], b[4], hit, blow;
	while (std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		hit = 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;
					}
				}
			}
		}
		std::cout << hit << ' ' << blow << '\n';
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  int a[4], b, hit, blow, i, j;
  while (cin >> a[0]) {
    hit = 0, blow = 0;
    for (i = 1; i < 4; i++) {
      cin >> a[i];
    }
    for (i = 0; i < 4; i++) {
      cin >> b;
      for (j = 0; j < 4; j++) {
	if (a[j] == b) {
	  if (i == j) {
	    hit++;
	  }
	  else {
	    blow++;
	  }
	}
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
int main ()
{
	while (1)
	{
		int a[4], b[4];
		int H = 0, B = 0;
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &a[i]) == EOF)return 0;
		}
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &b[i]) == EOF)return 0;
			if (b[i] == a[i])H++;
			for (int l = 0; l < 4; l++)
			{
				if (l == i)continue;
				if (a[l] == b[i])B++;
			}
		}
		cout << H << " " << B << endl;

	}
	return 0;
}

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

int main(void)
{
    int a[4], b[4], hit = 0, blow = 0;
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3])
    {
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        
        rep(i,4)
        {
            rep(j,4)
            {
                if(a[i] == b[j])
                {
                    if(a[i] == b[i])
                    {
                        hit++;
                        break;
                    }
                    else
                    {
                        blow++;
                        break;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }

    return 0;
}

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

int main(){
	int A[4], B[4];
	while( 1 ){
		int hit = 0, blow = 0;
		bool check[10] = {false};
		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++) check[A[i]] = true;
		for( int i=0; i<4; i++ ) if( A[i] != B[i] && check[B[i]] ) blow++;
		cout << hit << " " << blow << endl;
	}
}

C++: #include <cstdio>

#define rep(i, n) for(int i = 0; i < n; i ++)

using namespace std;

int main(void){
    int a[4], b[4];
    while(~scanf("%d %d %d %d", a, a + 1, a + 2, a + 3)){
        scanf("%d %d %d %d", b, b + 1, b + 2, b + 3);
        int hit = 0, blow = 0;

        rep(i, 4) rep(j, 4) 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() {
	int a[4], b[4];
	while(cin >> a[0]) {
		bool v[10];
		memset(v, 0, sizeof v);
		v[a[0]] = 1;
		for(int i = 1; i < 4; i ++) {
			cin >> a[i];
			v[a[i]] = 1;
		}
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i ++) {
			cin >> b[i];
			if(a[i] == b[i])
				hit ++;
			if(v[b[i]])
				blow ++;
		}
		blow -= hit;
		cout << hit << ' ' << blow << '\n';
	}
	return 0;
}

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

int main (){

    //data_set : a and b
    std::array<int, 4> data_a;
    std::array<int, 4> data_b;

    while(std::cin >> data_a[0] >> data_a[1] >> data_a[2] >> data_a[3]){
        std::cin >> data_b[0] >> data_b[1] >> data_b[2] >> data_b[3];
        int hit = 0;
        int blow = 0;
        for(int i = 0; i < 4; ++i){
            //if same digit and same num
            if(data_b[i] == data_a[i]) {
                hit++;
            } else {
                //if different digit and same num
                for (int j = 0; j < 4; ++j) {
                    if (data_b[i] == data_a[j]) {
                        blow++;
                    }
                }
            }
        }
        std::cout << hit << " " << blow << std::endl;

    }
}

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

int main(void){
  int a[4];
  int 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++){
    for(int j=0; j<4; j++){
      if(a[i]==b[j]){
        if(i==j){
          hit++;
        }else{
          blow++;
        }
      }
    }
  }

  cout <<hit<<"hit "<<blow<<"blow"<<endl;

  return 0;
}

C++: #include <iostream>
int main(){
	int a1,a2,a3,a4;
	int a[4],b[4],c;
	while(std::cin>>a1>>a2>>a3>>a4){
		int o=0,i=0;
			for(int v=0;v<4;v++){
			std::cin>>b[v];
		}
		
			for(int p=0;p<4;p++){
				if(a1==b[p]){
					if(0==p){
						o++;
					}else{
						i++;
					}
					}	if(a2==b[p]){
					if(1==p){
						o++;
					}else{
						i++;
					}
				}
						if(a3==b[p]){
					if(2==p){
						o++;
					}else{
						i++;
					}
					}	if(a4==b[p]){
					if(3==p){
						o++;
					}else{
						i++;
					}
				}
			}
		
	

		std::cout<<o<<" "<<i<<std::endl;
	}
	return 0;


}

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