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>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int a[5],b[5],hit=0,brow=0;
    while(scanf("%d",&a[0])!=EOF){
    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[i]){
                hit++;
                break;
            }
            else if(a[i]==b[j])brow++;
        }
    }
    cout<<hit<<" "<<brow<<endl;
    }
return 0;
}

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

int main()
{
	int a[4],b[4];

	while(~scanf("%d %d %d %d %d %d %d %d",&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<iostream>
#include<array>

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

C++: #include <stdio.h>
int main(){
int a[4],b[4],x,y;
while(scanf("%d%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
x=y=0;
for(int i=0;i<4;i++){
if(a[i]==b[i])x++;
else if(a[i]==b[(i+1)%4]||a[i]==b[(i+2)%4]||a[i]==b[(i+3)%4])y++;
printf("%d %d\n",x,y);
}
}}

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 <array>

int main(){
	std::array<u_int, 4> a,b;
	int hit,blow;

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

    return 0;
}

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

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

int main()
{
	int t,h,b,n[10];
	while(cin >> t)
	{
		memset(n,0,sizeof(n));

		n[t]=1; h=b=0;
		for(int i=1; i<4; i++)
		{
			cin >> t;
			n[t] = i+1;
		}

		for(int i=0; i<4; i++)
		{
			cin >> t;
			if(n[t]==i+1)    h++;
			else if(n[t]!=0) b++;
		}

		cout << h << " " << b << endl;
	}
}

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

#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++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    while (1)
    {
        vector<int> a(4), b(4);
        rep(i, 4)
        {
            cin >> a[i];
        }

        rep(i, 4)
        {
            cin >> b[i];
            if (cin.eof())
                return 0;
        }

        int hit = 0, blow = 0;

        rep(i, 4)
        {
            if (a[i] == b[i])
            {
                hit++;
            }
            else if (find(ALL(a), b[i]) != a.end())
            {
                blow++;
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++: #include <iostream>

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

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

struct HitAndBlow
{
    vector<int> cards;

    HitAndBlow(){
        cards = vector<int>(4);
    }

    void board(const HitAndBlow &other) const {
        int hit = 0, blow = 0;
        for (int i = 0; i < cards.size(); i++) {
            if (cards[i] == other.cards[i]) {
                hit++;
                continue;
            }
            for (int j = 0; j < cards.size(); j++)
                if (cards[i] == other.cards[j]) {
                    blow++;
                    break;
                }
        }
        cout << hit << " " << blow << endl;
    }
};

istream &operator >> (istream &is, HitAndBlow &g)
{
    for (int i = 0; i < g.cards.size(); i++)
        is >> g.cards[i];
    return is;
}

int main()
{
    for (HitAndBlow braker, maker; cin >> braker >> maker;)
        maker.board(braker);

    return 0;
}

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

int main(){
	while(1){
		int hit = 0, blow = 0;
		vector<int> a, b;
		int input;
		for(int i = 0; i < 4; i++){
			cin >> input;
			a.push_back(input);
		}
		for(int i = 0; i < 4; i++){
			cin >> input;
			b.push_back(input);
		}
		vector<int>::iterator a_ite, b_ite;
		for(a_ite = a.begin(); a_ite != a.end(); a_ite++){
			for(b_ite = b.begin();b_ite != b.end(); b_ite++){
				if(*a_ite == *b_ite) blow++;
			}
		}
		a_ite = a.begin();
		b_ite = b.begin();
		for(; a_ite != a.end(); a_ite++){
			if(*a_ite == *b_ite) hit++;
			b_ite++;
		}
		blow -= hit;

		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;
	int a[3],b[3],dat=1;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
	int a[3],b[3],dat=1;
		for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	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;
}