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<bits/stdc++.h>
using namespace std;

int ans[4], in[4];

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

  return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int ss[8],i,j;
	int ans[2];
	
	for(;cin >> ss[0];)
	{
		ans[0]=ans[1]=0;
		
		for(i=1;i<8;i++)
		{
			cin >> ss[i] ;
		}
		
		for(i=0;i<4;i++)
		{
			if(ss[i]==ss[i+4])
			{
				ans[0]++;
				ss[i+4]=-1;
			}
		}
		for(i=0;i<4;i++)
		{
			for(j=4;j<8;j++)
			{
				if(ss[i]==ss[j])
				{
					ans[1]++;
				}
			}
		}
		cout << ans[0] << " " << ans[1] << endl;
	}
}

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

int main() {
	vector<int> a(4), b(4);
	do{
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) cin >> b[i];
		
		int hit = 0, blow = 0;
		for( int i=0; i<4; ++i ){
			for( int j=0; j<4; ++j ){
				if( a[i] == b[j] ){
					( i==j ? hit : blow ) += 1;	
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}while(!cin.eof());
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){

	vector<int> a(4);
	vector<int> b(4);
	
	while(cin >> a[0]){
		vector<bool> used(10, false);
		int hit = 0, blow = 0;
		used[a[0]] = true;
		REP(i, 1, 4){
			cin >> a[i];
			used[a[i]] = true;
		}
		rep(i, 4){
			cin >> b[i];
			if(a[i] == b[i]) hit++;
			else if(used[b[i]]) blow++;
		}
		
		cout << hit << " " << blow << endl;
		
	}

	
	return 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define F first
#define S second
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

int main(){
	li a[4], b[4];
	while(cin>>a[0]){
		li hit=0, blow=0;
		repp(i,1,4)cin>>a[i];
		rep(i,4)cin>>b[i];
		
		rep(i,4){
			bool found=false;
			rep(j,4){
				if(b[i]==a[j]){
					found=true;
					break;
				}
			}
			if(found){
				if(b[i]==a[i])hit++;
				else blow++;
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	
	return 0;
}

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

int main(){

  int a[8];

  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6] >> a[7]){

    int hit=0,blow=0;

    for(int i=0;i<4;i++){
      if(a[i]==a[i+4]){
	hit++;
	a[i]=-1*i;
	a[i+4]=-1*(i+4);
      }
    }

    for(int i=0;i<4;i++){
      for(int j=4;j<8;j++){
	if(a[i]==a[j]){
	  blow++;
	  a[i]=-1*i;
	  a[j]=-1*j;
	}
      }
    }

    cout << hit << ' ' << blow << endl;
  }
}

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 <vector>
#include <algorithm>
using namespace std;

int main()
{
 int a[4];
 int b[4];
 while(cin>>a[0]>>a[1]>>a[2]>>a[3])
 {
   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,b,c,d,e,f,g,h,x,y;
    
    while (cin >> a >> b >> c >> d) {
    x = 0;
    y = 0;
    cin >> e >> f >> g >> h;
        if (a==e){x=x+1 ;e=e+10;} 
        if (b==f){x=x+1;f=f+10;} 
        if (c==g){x=x+1;g=g+10;}
        if (d==h){x=x+1;h=h+10;}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " <<  y << 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>>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[i]){
					hit++;
					break;
				}else if(a[i] == b[j] && i!=j){
					blow++;
					break;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int size = 4;
	int ina[size];
	int inb[size];
	while(true){
		int hit=0, blow=0;
		cin>>ina[0]>>ina[1]>>ina[2]>>ina[3];
		cin>>inb[0]>>inb[1]>>inb[2]>>inb[3];
		if(cin.eof()) break;
		for(int i=0; i<size; i++) {
			if(ina[i] == inb[i]) hit++;
			for(int j=0; j<size; j++){
				if(i==j) continue;
				if(ina[i] == inb[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]>>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++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie acos(-1)
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int a,b,c,d,e,f,g,h;
signed main(){
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        int x=0;
        if(a==e)x++;
        if(b==f)x++;
        if(c==g)x++;
        if(d==h)x++;
        cout<<x<<" ";
        int y=0;
        if(a==f||a==g||a==h)y++;
        if(b==e||b==g||b==h)y++;
        if(c==e||c==f||c==h)y++;
        if(d==e||d==f||d==g)y++;
        cout<<y<<endl;
    }
}