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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	vint a(4), b(4);
	while(true)
	{
		rep(i, 8)
			cin >> (i < 4 ? a[i] : b[i-4]);
		if(cin.eof()) break;

		int hit = 0;
		rep(i, 4)
			hit += a[i] == b[i];

		int brow = -hit;
		rep(i, 4)
			brow += (a[i] == b[0] || a[i] == b[1] || a[i] == b[2] || a[i] == b[3]);
		cout << hit << " " << brow << endl;
	}
}

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
#define DEBUG false

int main()
{
    while (true)
    {
        int a[4], b[4];
        if (cin.eof())
            break;
        rep(j, 4) cin >> a[j];
        rep(j, 4) cin >> b[j];
        int hit = 0, bl = 0;
        rep(i, 4)
        {
            rep(j, 4)
            {
                if (a[i] == b[j])
                {
                    if (i == j)
                        hit++;
                    else
                        bl++;
                }
            }
        }
        cout << hit << ' ' << bl << endl;
    }
    return 0;
}

C++: #include<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow,x,z;
	double stoped;
	
	
	//while(scanf("%lf%lf",&x,&z)!=EOF){
		
		x=0,z=0;
		hit=0,brrow=0;
	
		for(i=0;i<4;i++){
			scanf("%d",&x);
			a[i]=x;
		}

		for(i=0;i<4;i++){
			scanf("%d",&z);
			b[i]=z;
		}

		for(i=0;i<4;i++){		//hit
			if(a[i]==b[i]){
				hit++;
			}
		}
	
		for(i=0;i<4;i++){		//brrow
			for(j=0;j<4;j++){
				if(a[i]==b[j] && i!=j){
					brrow++;
				}
			}
		}	
		printf("%d %d\n",hit,brrow);
	//}
	return 0;
}

C++: #include<iostream>

int main(){
int a[4],b[4],i,j,H,B;
	while(std::cin>>a[0]){
		for(i=1;i<4;i++){
			std::cin>>a[i];
		}
		for(j=0;j<4;j++){
			std::cin>>b[j];
		}
		H=0;
		B=0;
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					if(i==j){
						H++;
					}
					else{
						B++;
					}
				}
			}
		}
		std::cout<< H << " " << B <<std::endl;
	}
return 0;
}

C++: #include <cstdio>
 
int main(){
  int a[4],b[4];
  while(~scanf("%d %d %d %d\n%d %d %d %d\n",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])){
    int c=0,d=0;
    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++)
    if(a[i]==b[j])
      i==j?c++:d++;
    printf("%d %d\n",c,d);
  }
}

C++: #include <iostream>
int main()
{

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

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

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

    return 0;
}

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

int p[4],q[4];
int main(){
    while(cin>>p[0]){
        for(int i=1;i<4;i++)cin>>p[i];
        for(int i=0;i<4;i++)cin>>q[i];

        int h=0,b=0;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(p[i]==q[j]){
                    if(i==j)h++;
                    else b++;
                }
            }
        }
        cout<<h<<" "<<b<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
   
int main(){
    std::vector<int> a(4);
       
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
           
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
               
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
                ++hit;
            }else if(it != a.end()){
                ++blow;
            }
        }
        std::cout << hit << " " << blow << std::endl;
    }
      
    return 0;
}

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

int main(){
  while(cin){
	int input,hit=0;
	vector<int> a,b,c,d;
	for(int i=0;i<8;++i) {
	  cin >> input;
	  a.push_back(input);
	}
	for(int i=0;i<4;++i){
	  if(a[i] == a[i+4]){
		b.push_back(a[i]);
		hit++;
	  }
	}
	set_intersection(a.begin(),a.begin()+4,a.begin()+5,a.end()+8,back_inserter(c));
	set_difference(c.begin(),c.end(),b.begin(),b.end(),back_inserter(d));	
	cout << hit << ' ' << d.size() << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
  int a[4],b[4];
  int hit,blow;
  while(cin >> a[0]){
    for(int i=1;i<4;i++)cin >> a[i];
    for(int i=0;i<4;i++)cin >> b[i];
    hit = blow = 0;
    for(int i=0;i<4;i++){
      if(a[i] == b[i])hit++;
      for(int j=i+1;j<4;j++){
	if(a[i] == b[j])blow++;
      }
    }
    cout << hit << ' ' << blow << endl;
  }
}

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

int main(){
	int A[4];
	int B[4];
	int hit;
	int blow;
	while(cin >> A[0] >> A[1] >> A[2] >> A[3]){
		hit = 0;
		blow = 0;
		cin >> B[0] >> B[1] >> B[2] >> B[3];
		for(int i=0;i<4;i++){
			if(A[i] == B[i]){
				hit += 1;
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i != j && A[i] == B[j]){
					blow += 1;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}