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 <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <queue>
#include <string>
#include <map>
#include <vector>

using namespace std;

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

C++: #include<iostream>

using namespace std;

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

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

C++: #include <bits/stdc++.h>
using namespace std;

const int INF = 1e+9 * 2;
double eps = 1e-10;

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

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////

int main() {
	int as[4];
	int bs[4];
	while (scanf("%d%d%d%d", as, as+1, as+2, as+3) != EOF) {
		scanf("%d%d%d%d", bs, bs+1, bs+2, bs+3);
		int h = 0, b = 0;
		REP(i, 4) {
			if (as[i] == bs[i]) {
					h++;
			}	else {
				REP(j, 4) {
					if (i == j) continue;
					if (bs[i] == as[j]) {
						b++;
					}
				}
			}
		}
		cout << h << SPACE << b << endl;

	}
}

// END   //////////////////////////////////////////////////////////////

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int a, b, c, d, e, f, g, h;

	while ( cin >> a >> b >> c >> d >> e >> f >> h >> h )
	{
		vector<int> pa;
		pa.push_back( a );
		pa.push_back( b );
		pa.push_back( c );
		pa.push_back( d );
		
		vector<int> pb;
		pb.push_back( e );
		pb.push_back( f );
		pb.push_back( g );
		pb.push_back( h );

		int hit, blow;
		hit = blow = 0;

		for ( unsigned int i = 0; i < 4; i++ )
		{
			for ( unsigned int j = 0; j < 4; j++ )
			{
				if ( pa[i] == pb[j] )
				{
					if ( i == j )
					{
						hit++;
					}
					else
					{
						blow++;
					}
				}
			}
		}

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

	return 0;
}

C++: #include<iostream>

int main(){
	int a[4],b[4],i,n,hit=0,blow=0;


	while(std::cin>>a[0]){

	for(i=0;i<4;i++){
		std::cin>>a[i];
	}
	
	for(i=0;i<4;i++){
		std::cin>>b[i];
	}

	for(i=0;i<4;i++){
		for(n=0;n<4;n++){
			if(a[i]==b[n]){
				if(i==n){
					hit++;
				}
				else blow++;
			}
		}
	}

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

	return 0;

	}

}

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

using namespace std;

int main() {
	int a[4], b[4];
	
	a[0] = -1;
	cin >> a[0];
	
	while (a[0] != -1) {
		cin >> a[1] >> a[2] >> a[3];
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		
		int hit = 0;
		int bite = 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 (i == j) continue;
				
				if (a[i] == b[j]) {
					bite++;
					break;
				}
			}
		}
		
		cout << hit << " " << bite << endl;
		
		a[0] = -1;
		cin >> a[0];
	}
	
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
using namespace std;
int main() {
	int a1,a2,a3,a4,b1,b2,b3,b4,k,l,m,hit,blow;
	vector<int> s,t,u;
	while (cin>>a1>>a2>>a3>>a4>>b1>>b2>>b3>>b4) {
		hit = 0;
		blow = 0;
		s.clear();
		t.clear();
		s.push_back(a1);
		s.push_back(a2);
		s.push_back(a3);
		s.push_back(a4);
		t.push_back(b1);
		t.push_back(b2);
		t.push_back(b3);
		t.push_back(b4);
		for (k = 0; k < 4; k++) {
			if (s[k] == t[k]&&s[k]>=0) {
				hit += 1;
				s[k] = -1;
				t[k] = -1;
			}
		}
		for (l = 0; l < 4; l++) {
			for (m = 0; m < 4; m++) {
				if (s[l] == t[m] && s[l] > 0) {
					blow += 1;
					s[l] = -1;
					t[m] = -1;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int h=0,n=0;
	while(1){
	int a[3],b[3],dat=1;
	for(int	i=0;i<4;i++){
			cin>>dat;
			a[i]=dat;
	}
	for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	if(dat==EOF){
		break;
	}
	for(int k=0;k<4;k++){
		for(int o=0;o<4;o++){
			if(a[k]==b[k]){
				h++;
			}
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	}
	cout<<h<<endl;
	cout<<n<<endl;
	return 0;
}