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 <cmath>
#include <vector>


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

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

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

int main(){
    std::vector<int> a, b;
    a.resize(4);
    b.resize(4);
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
        int hitcount = 0, blowcount = 0;
        for(int i = 0; i < 4; ++i){
            if(a.at(i) == b.at(i))
                ++hitcount;
        }
        for(int value_a : a){
            for(int value_b : b){
                if(value_a == value_b)
                    ++blowcount;
            }
        }
        std::cout << hitcount << " " << blowcount - hitcount << std::endl;
    }
}

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

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
template<typename V> typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  vi a(4), b(4);
  while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
    vi c, d;
    int jimei = 0;
    rep(i, 4) {
      if (a[i] == b[i]) {
        jimei++;
      } else {
        c.pb(a[i]), d.pb(b[i]);
      }
    }
    vi fooooo;
    sort(all(c)), sort(all(d));
    set_intersection(all(c), all(d), back_inserter(fooooo));
    cout << jimei << ' ' << fooooo.size() << endl;
  }
}

C++: #include <stdio.h>

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

        while (scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF) {

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

C++: #include<iostream>
using namespace std;
int main() {
	int n = 0;
	while (cin >> n) {
		int a[4], b[4];
		int hit = 0, blow = 0;
		a[0] = n;
		cin >> 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 (i == j && a[i] == b[i]) {
					++hit;
				}
				else if (a[j] == b[i]) {
					++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];
		if (cin.eof()) break;
		
		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;

	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    // Here your code !
    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,blo=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]) blo++;
        }}
        
        cout<<hit<<" "<<blo-hit<<endl;
    }
}

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

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

int main(){
	std::array<u_int, 4> a,b;

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> 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(a[i]==b[j]) blow++;
			}
		}
		std::cout << hit << blow-hit << std::endl;
	}

    return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    vector<int> a(4);
    vector<int> b(4);
    while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
        rep(i,4) cin >> b[i];
        int hit = 0,blow = 0;
        rep(i,4){
            if(a[i] == b[i]) hit++;
            else {
                rep(j,4) if(a[j] == b[i]) blow++;
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}