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 <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	while (1){
	vector<int> a(4);
	vector<int> b(4);
	int hit_count=0;
	int blow_count=0;
	REP(i,4){
		cin>>a[i];
	}
	REP(i, 4){
		cin >> b[i];
	}
	REP(i, 4){
		if (a[i] == b[i]){
			hit_count++;
		}
	}
	REP(i, 4){
		REP(j, 4){
			if (i==j)continue;
			if (a[i] == b[j]){
				blow_count++;
			}
		}
	}
	cout << hit_count << " "<<blow_count<<endl;
	}
}

C++: #include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from); x<(to); (x)++)
#define rep(x,to) rep2(x,0,to)
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;
		rep(i,4) {
			rep(j,4) {
				if(a[i] == b[j]) {
					if(i == j) hit++;
					else blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

int main()
{
	int a[4];
	int b[4];
	while (cin >> a[0])
	{
		for (int i = 1; i < 4; i++) cin >> a[i];
		for (int i = 0; i < 4; i++) cin >> b[i];

		int hit = 0;
		int blow = 0;

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

C++: #include <stdio.h>

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

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

int main(){
  for (int k = 0; k < 50; k++) {
    vector<int> a(4), b(4);
    for (int i = 0; i < 4; i++) {
      cin >> a.at(i);
    }
    for (int i = 0; i < 4; i++) {
      cin >> b.at(i);
    }
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        if (a.at(i) == b.at(j)) {
          if (i == j) {
            hit++;
          } else {
            blow++;
          }
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
}

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

int main(){
  for (;;) {
    vector<int> a(4), b(4);
    for (int i = 0; i < 4; i++) {
      cin >> a.at(i);
    }
    for (int i = 0; i < 4; i++) {
      cin >> b.at(i);
    }
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        if (a.at(i) == b.at(j)) {
          if (i == j) {
            hit++;
          } else {
            blow++;
          }
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
}

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

C++: #include <iostream>

using namespace std;

int main()
{
	int i, j;
	int hit, blow;
	int numa[4];
	int numb[4];
	
	while(1)
	{
		if (cin.eof())
		{
			break;
		}
		
		for(i = 0; i < 4; i++)
		{
			cin >> numa[i];
		}
		
		for(i = 0; i < 4; i++)
		{
			cin >> numb[i];
		}
		
		
		hit = 0;
		for(i = 0; i < 4; i++)
		{
			if(numa[i] == numb[i])
			{
				hit = hit + 1;
			}
		}
		blow = 0;
		for(i = 0; i < 4; i++)
		{
			for(j = 0; j < 4; j++)
			{
				if(numa[i] == numb[j] && i != j)
				{
					blow = blow + 1;
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}
		
	
	cout << hit << " " << blow << endl;
	return 0;
}

C++: #include<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow;
	double stoped;
	
	

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

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

		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>
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 <cstdio>
int main()
{
    int a[4], b[4];
    while (scanf("%d%d%d%d", a, a+1, a+2, a+3) != EOF) {
        scanf("%d%d%d%d", b, b+1, b+2, b+3);
        int c = 0, d = 0;
        for (int i = 0; i < 4; ++i) if (a[i] == b[i]) c++;
        for (int i = 0; i < 4; ++i)
            for (int j = 0; j < 4; ++j)
                if (i != j && a[i] == b[j]) d++;
        printf("%d %d\n", c, d);
    }
    return 0;
}