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>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x=0,y=0;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h){
        x=0;
        y=0;
        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 i,j;
	int a[4];
	int b[4];
	while(!cin.eof()){

		int hit =  0;
		int blow = 0;

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

		for(i=0;i<4;++i){
			for(j=0;j<4;++j){
				if(b[i] == a[j]){
					(j == i) ? ++hit : ++blow;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a[4];
	int b[4];
	while(cin>>a[0]){
		rep(i,3)cin>>a[i+1];
		rep(i,4)cin>>b[i];
		int h=0,br=0;
		rep(i,4)loop(j,i,4)if(a[i]==b[j]){
			if(i==j)h++;
			else br++;
		}
		cout<<h<<" "<<br<<endl;
	}
}

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

C++: #include <iostream>

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

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

int main()
{
    int a[4],b[4];
    while(~scanf("%d%d%d%d\n%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])) {
        int hi=0,bl=0;
        for(int i=0;i<4;++i) {
            if (a[i]==b[i]) { ++hi; continue; }
            for(int j=0;j<4;++j) {
                if (i == j) continue;
                if (a[i] == b[j]) ++bl;
            }
        }
        printf("%d %d\n", hi, bl);
    }

    return 0;
}

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

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
  	blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << ' ' << 8-(int)(blowing.size()) << std::endl;
    blowing.clear();
  }
return 0;
}

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


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

int main(){
    int a[4]={0},b[4]={0};
    while(true){
        scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
        if(scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]) == EOF)
            break;
        int 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(i != j && a[i] == b[j])
                    blow++;
        cout << hit << ' ' << blow << endl;
    }

    return 0;
}

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

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

struct data{
	int num;
	int counted;
};

int main(){
	data a[4];
	data b[4];
	while(cin >> a[0].num >> a[1].num >> a[2].num >> a[3].num
		>> b[0].num >> b[1].num >> b[2].num >> b[3].num)
	{
		int hit = 0;
		int blow = 0;
		for(int i = 0; i < 4; i++){
			a[i].counted = 1;
			b[i].counted = 1;
		}
		for(int j = 0; j < 4; j++){
			if(a[j].num == b[j].num){
				a[j].counted = b[j].counted = 0;
				hit++;
			}
		}
		for(int k = 0; k < 4; k++){
			for(int l = 0; l < 4; l++){
				if(a[k].counted == 1 && b[l].counted == 1){
					if(a[k].num == b[l].num){
						a[k].counted = b[l].counted = 0;
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

int main() {
	int a[4], b[4];
	while (cin >> a[0]) {
		rep (i, 3) cin >> a[i + 1];
		rep (i, 4) cin >> b[i];

		int hit = 0, blow = 0;
		rep(i, 4) {
			rep(j, 4) {
				if (a[i] == b[j]) {
					if (a[i] == b[i]) {
						hit++;
					} else {
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

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 num[10]; CLR(num);
    int hit = 0, blow = 0;
    FOR(i,0,4) {
      if(a[i] == b[i]) hit++;
      num[a[i]]++;
      num[b[i]]++;
    }
    FOR(i,0,10) if(num[i] > 1) blow++;
    cout << hit << " " << blow - hit << endl;
  }
  return 0;
}