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(){
  int a[4],c[4];
  while(1){
    int e=0,b=0,k;
    for(int i=0;i<4;i++)
      k=cin >> a[i];
    if(!k)break;
    if(a[i]==-1)break;
    for(int i=0;i<4;i++){
      cin >> c[i];
      for(int j=0;j<4;j++)
	if(c[i]==a[j]){
	  if(i==j)e++;
	  else b++;
	}
    }
    cout<<e<<' '<<b<<endl;
  }
  return 0;
}

C++: #include <stdio.h>

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

	while (true) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 0;
		}
		if (sscanf(line, "%d %d %d %d", &(a[0]), &(a[1]), &(a[2]), &(a[3])) != 4) {
			return 0;
		}

		if (fgets(line, sizeof line, stdin) == NULL) {
			return 0;
		}
		if (sscanf(line, "%d %d %d %d", &(b[0]), &(b[1]), &(b[2]), &(b[3])) != 4) {
			return 0;
		}
		
		int h = 0;
		int w = 0;
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) {
						h++;
					} else {
						w++;
					}
				}
			}
		}
		printf("%d %d\n", h, w);
	}

	return 0;
}

C++: #include <iostream>
#include <array>
int checkNumOfHit(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < 4;i++){
        if(x.at(i) == y.at(i)) num++;
    }
    return num;
}

int checkNumOfBlow(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < x.size();i++){
        for(int j = 0;j < y.size();j++){
            if((i != j) && (x.at(i) == y.at(j))) num++;
        }
    }
    return num;
}
int main(){
    std :: array<int, 4> a, b;
    while(std :: cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3)>> b.at(0) >> b.at(1) >> b.at(2) >> b.at(3)){  
        std :: cout << checkNumOfHit(a, b) << "\0" << checkNumOfBlow(a, b) << std :: endl;
    }
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<queue>
#include<algorithm>
#include<utility>
#include<vector>
#include<list>
using namespace std;
int main() {
	int a[8], hit = 0, blow = 0, k = 0, f, cnt=0;
	while (cin >> f) {
		a[k] = f;
		k++;
		if (k % 8 == 0) {
			for (int i = 0; i < 4; ++i) {
				if (a[i] == a[i+4]) {
					hit++;
					a[i] = -1;
					a[i+4] = -1;
					continue;
				}
				for (int j = 0; j < 4; ++j) {
					if (a[i] == a[j+4] )blow++;
				}
			}
			cout << hit << " " << blow << endl;
			k = 0;
			hit = 0;
			blow = 0;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

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

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

int main(){
  int hit,blow,w,x,y,z;
  vi a(4,0),b(4,0) ;
  while(cin >> w >> x >> y >> z){
    hit = 0,blow = 0;
    a[0] = w,a[1] = x,a[2] = y,a[3] = z ;
    for(int i =0; i < 4; ++i){
      cin >> x ;
      b[i] = x ;
    }
    rep(i,4){
      rep(j,4){
        if(a[i] == b[j] && i == j){
          ++hit ;
        }
        else 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] >> a[1] >> a[2] >> a[3]){
		int hit = 0 , bro = 0;
		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]){
					if(i==j)	hit++;
					else	bro++;
				}
			}
		}
		cout << hit << ' ' << bro << endl; 
	}
}

C++: #include<iostream>
using namespace std;
 
int main(void){
  int a[4];
  int b[4];
  int hit=0;
  int blow=0;
 
  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++){
    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 <stdio.h>

int main(void) {
  int n, i, j, k, a[4], b[4];
  while(scanf("%d", &a[0]) != EOF) {
    for(i = 1; i < 4; ++i) scanf("%d", &a[i]);
    for(i = 0; i < 4; ++i) scanf("%d", &b[i]);
    int h = 0, bl = 0, flag[10];
    for(i = 0; i < 10; ++i) flag[i] = 0;
    for(i = 0; i < 4; ++i) {
      if(a[i] == b[i]) h++;
      else flag[a[i]] = 1;
    }
    for(i = 0; i < 4; ++i) if(flag[b[i]]) ++bl;
    printf("%d %d\n", h, bl);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int a[4]={0};
  int b[4]={0};
  int i,j;
  while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
    cin>>b[0]>>b[1]>>b[2]>>b[3];
    int h=0,bl=0;
    for(i=0;i<4;i++){
      if(a[i]==b[i]){
	h++;
      }
      for(j=0;j<4;j++){
	if(a[i]==b[j]){
	  bl++;
	}
      }
    }
    bl-=h;
    cout<<h<<" "<<bl<<endl;
  }
  return 0;
}

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

int main()
{
	int a[5],b[5];
	
	while(1){
		int hit=0,blow=0;
		
		scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		
		for(int i=0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				continue;
			}
			blow = count(a,a+4,b[i]);
		}
		printf("%d %d\n", hit, blow);
	}
	
	return (0);
}

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

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

	while (1){
		cin >> a[0] >> a[1] >> a[2] >> a[3];
		cin >> b[0] >> b[1] >> b[2] >> b[3];

		hit = 0;
		blow = 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]) blow++;
			}
		}
		blow -= hit;

		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;


int main(){
	
	int A[4] = {};
	int B[4] = {};
	
	int yes = 0;
	int no = 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] ) {
		
		if( i == j)
		yes++;
		
		else
		no++;
	}
	cout << yes << " " << no << "\n"; 
    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;
			
	                else
			blow += std::count(A.begin(), A.end(), B[i]);

		}

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

		return 0;

}

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

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