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 <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	while (1)
	{
		vector<int> a(4, 0), b(4, 0);
		int hit = 0, blow = 0;
		rep(i, 4) { cin >> a[i]; }
		rep(i, 4) { cin >> b[i]; }
		rep(i, 4)
		{
			if (a[i] == b[i]) { hit += 1; }
		}
		rep(i, 4)
		{
			blow += count(all(b), a[i]);
		}
		printf("%d %d\n", hit, blow - hit);
	}
	


	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int h = 0, v = 0;
	int a[5], b[5];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	while (cin >> b[0] >> b[1] >> b[2] >> b[3]){
		REP(i,4){
			REP(j, 4){
				if (b[i] == a[j]){
					v++;
					if (i == j){
						v--;
						h++;
					}
				}
			}
		}
		cout << h << " " << v << endl;
		h = v = 0;
	}
}

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

int main(){
	std::array<int, 4> a;
	std::array<int, 4> b;
	int hit = 0;
	int blow = 0;

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3] && std::cin >> b[0] >> b[1] >> b[2] >> b[3]){

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

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

		hit = 0;
		blow = 0;
	}

}

C++: #include <cstdio>
#include <vector>

using namespace std;

bool testcase_ends() {
    vector<int> a(4);
    for (size_t i=0; i<4; ++i)
        if (scanf("%d", &a[i]) == EOF)
            return 1;

    vector<int> b(4);
    for (size_t i=0; i<4; ++i)
        scanf("%d", &b[i]);

    int hit=0, blow=0;
    for (size_t i=0; i<4; ++i)
        for (size_t j=0; j<4; ++j)
            if (a[i] == b[j])
                ++(i==j? hit:blow);

    printf("%d %d\n", hit, blow);
    return 0;
}

int main() {
    int solved=0;
    while (!testcase_ends())
        ++solved;

    return !solved;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,hit,blow,flg[4];
	int a[4],b[4];
	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]);
		for(i=0;i<4;i++) flg[i]=0;
		hit=0; blow=0;
		for(i=0;i<4;i++) {
			if(a[i]==b[i]) {
				hit++;
				flg[i]=1;
			}
		}
		for(i=0;i<4;i++) {
			for(j=0;j<4;j++) {
				if(a[i]==b[j] && flg[i]==0) 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;
		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;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>

#define int64 long long int

using namespace std;

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

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

using namespace std;
#define N 4

int main(void)
{
    ios::sync_with_stdio(false);
    int a[N], b[N];
    int hit, blow;

    while(cin >> a[0] >> a[1] >> a[2] >> a[3], !cin.eof()) {
        for(int i=0; i<N; i++) cin >> b[i];

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

int main(void){
    int a[4];
    int b[4];
    
    while((scanf("%d", a[0])) != EOF){
        int hitcount = 0;
        int bcount   = 0;
        
        for(int i = 1; i < 4; i++){
            scanf("%d", a[i]);
        }
        
        for(int i = 0; i < 4; i++)
            cin >> b[i];
        
        //a???????????????????????????????´????b????????¢??¢?´¢
        for(int i = 0; i < 4; i++){
            int x = a[i];
            for(int j = 0; j < 4; j++){
                if(x == b[j]){
                    if(i == j) hitcount++;
                    else bcount++;
                }
            }
        }
        
        cout << hitcount << " " << bcount << endl;
    }
    
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	int A[4] = {}, B[4] = {};
	int hit, blow;
	while (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){
			if (A[i] == B[i]){
				++hit;
				continue;
			}
			for (int j = 0; j < 4; ++j){
				if (i == j) continue;
				if (A[i] == B[j]) ++blow;
			}
		}
		cout << hit << " " << blow << "\n";
	}
	return 0;
}

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

int main() {
	array<int, 4> a, b;
	while (1) {
		for (auto& A : a) cin >> A;
		for (auto& B : b) cin >> B;
		if (!cin) break;
		
		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++;
					}
					break;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

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

int main(void){
  int a[4];
  int b[4];
  int count=0;
  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<3; i++){
    for(int j=i+1; j<4; j++){
      if(a[i] == a[j]){
        count++;
      }
      if(b[i] == b[j]){
        count++;
      }
    }
  }
  if(count==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 num[4], tmp[4], hit, blow;
	
	while (1) {
		hit = 0; blow = 0;
		
		cin >> num[0] >> num[1] >> num[2] >> num[3];
		cin >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3];
		
		for (int i=0; i<4; i++)
			for (int j=0; j<4; j++)
				if (num[i] == tmp[j]) {
					if (i == j) hit++;
					else		blow++;
				}
		cout << hit << " " << blow << endl;
		
		if (cin.eof()) break;
	}
	return 0;
}