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<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;
vector<int> v1(4);
vector<int> v2(4);
int main()
{
  while(scanf("%d %d %d %d",&v1[0],&v1[1],&v1[2],&v1[3])!=EOF){
    scanf("%d %d %d %d",&v2[0],&v2[1],&v2[2],&v2[3]);
    int i,j,hit=0,blow=0;
    rep(i,4){
      if(v1[i]==v2[i])
	hit++;
      else
	rep(j,4){
	  if(i==j)continue;
	  if(v1[i]==v2[j])blow++;
	}
    }
    cout<<hit<<" "<<blow<<endl;
  }
}

C++: #include <iostream>
using namespace std;
int main( void )
{
  int a[4],b[4],hit,blow;
  while( 1 ){
    for( int i=0; i<4; i++ ) cin >> a[i];
    for( int i=0; i<4; i++ ) cin >> b[i];
    if( cin.eof() ) break;
    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],b[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3],!cin.eof()){
        int Hit=0,Blow=0;
        bool hantei[4];
        cin>>b[0]>>b[1]>>b[2]>>b[3];
        if(cin.eof()){
            break;
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i]){
                Hit++;
                hantei[i]=true;
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i==j){
                    continue;
                }
                if(!(hantei[i]) && b[i]==a[j]){
                    if(!hantei[j]){
                        Blow++;
                        break;
                    }
                }
            }
        }
        cout<<Hit<<' '<<Blow<<endl;
    }
    return 0;
}

C++: #include <iostream>

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

C++: #include <iostream>

using namespace std;

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

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

  return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a[4],b[4];
    while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
        int h = 0,bs = 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{
                        bs++;
                    }
                }
            }
        }
    cout << h << " " << bs << endl;
    }
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	vector<int> A(4),B(4);
	while(cin>>A[0]){
		vector<int> AN(10,0);
		AN[A[0]]++;
		REP(i,3){
			A[i+1]=in();
			AN[A[i+1]]++;
		}
		int blow=0,hit=0;
		REP(i,4){
			B[i]=in();
			if(AN[B[i]]) blow++;
			if(A[i]==B[i]){
				blow--;
				hit++;
			}
		}
		out(hit,blow);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void)
{
	int a1,a2,a3,a4,b1,b2,b3,b4;
	while(cin>>a1>>a2>>a3>>a4>>b1>>b2>>b3>>b4)
	{
		int hit,blow;
		hit=blow=0;
		if(a1==b1) hit++;
		else if(a1==b2||a1==b3||a1==b4) blow++;
		if(a2==b2) hit++;
		else if(a2==b1||a2==b3||a2==b4) blow++;
		if(a3==b3) hit++;
		else if(a3==b1||a3==b2||a3==b4) blow++;
		if(a4==b4) hit++;
		else if(a4==b1||a4==b2||a4==b3) blow++;
		cout<<hit<<" "<<blow<<endl;
	}
}

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

using namespace std;

void Solution()
{
//    int a1, a2, a3, a4;
//    int b1, b2, b3, b4;
//    
//    int a[2][4] = {a1, a2, a3, a4, b1, b2, b3, b4};
    
    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]) && (i == j))
                {
                    
                    hit++;
                }
                else if((a[i] == b[j]) && (i != j))
                {
                    blow++;
                }
            }
        }
        
        cout<<hit<<" "<<blow<<endl;
    }
    
    return;
}

int main()
{
    Solution();
    return 0;
}

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

int main()
{
    int ans_a[100],ans_b[100];
    int hit=0,brow=0;
    
    while (cin>>ans_a[0]>>ans_a[1]>>ans_a[2]>>ans_a[3]>>ans_b[0]>>ans_b[1]>>ans_b[2]>>ans_b[3]) {
        for (int i=0; i<4; i++) {
            for (int j=0; j<4; j++) {
                if (ans_a[i]==ans_b[j]&&i==j) {
                    hit++;
                }
                else if(ans_a[i]==ans_b[j]) {
                    brow++;
                }
            }
        }
        cout<<hit<<brow<<endl;
    }
    
    return 0;
}

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

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
int hit, blow;
string a, b;
int main(){
	while(getline(cin, a)){
		getline(cin, b);
		hit = 0;
		blow = 0;
		for(int i = 0; i < 7; i += 2){
			if(b[i] == a[i]){
				hit++;
			}
			else if(a.find(b[i]) != -1){
				blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}