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 <stdio.h>

int main(){
  int a[4], b[4];
  while(scanf("%d%d%d%d%d%d%d%d", a,a+1,a+2,a+3,b,b+1,b+2,b+3)!=EOF){
    int x[10];
    int i;
    for(i=0;i<10;i++) x[i] = 0;

    for(i=0;i<4;i++) x[a[i]] = i+1;

    int hit=0, blow=0;

    for(i=0;i<4;i++){
      if(x[b[i]]){
        if(x[b[i]] == i+1) hit++;
        else blow++;
      }
    }
    printf("%d %d\n", hit, blow);
  }
}

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

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

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

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

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

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> a(4, 0), b(4, 0);

	while (cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		int hit = 0, blow = 0;
		rep(i, 4) { cin >> b[i]; }
		rep(i, 4)
		{
			if (a[i] == b[i]) { hit += 1; }
		}
		rep(i, 4)
		{
			blow += count(all(b), a[i]);
		}
		printf("%d %d\n", hit, blow - hit);
	}
	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

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

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

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		int h=0,n=0;

		for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	for(int k=0;k<4;k++){
			if(a[k]==b[k]){
				h++;
			}

		for(int o=0;o<4;o++){
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	cout<<h<<" "<<n<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <array>
//ヒットの数を数え上げる
int checkNumOfHit(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < 4;i++){
        if(x.at(i) == y.at(i)) num++;
    }
    return num;
}

//ブローの数を数え上げる
int checkNumOfBlow(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < x.size();i++){
        for(int j = 0;j < y.size();j++){
            if((i != j) && (x.at(i) == y.at(j))) num++;
        }
    }
    return num;
}
int main(){
    std :: array<int, 4> a, b;
    while(std :: cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3)>> b.at(0) >> b.at(1) >> b.at(2) >> b.at(3)){  
        std :: cout << checkNumOfHit(a, b) << checkNumOfBlow(a, b) << std :: endl;
    }
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a[4];
	int b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		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])
				{
					if(i == j)
					{
						++Hit;
					}
					else
					{
						++Blow;
					}
				}
			}
		}
		cout << Hit << " " << Blow << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

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

}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int a[4];
	while(1){
		rep(i, 4){
			if(scanf("%d", &a[i]) == EOF)
				return 0;
		}

		int hit=0, blow=0;
		rep(i, 4){
			int b;
			scanf("%d", &b);
			rep(j, 4) (i==j ? hit : blow) += a[j] == b;
		}

		printf("%d %d\n", hit, blow);
	}

	return 0;
}

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

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;

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

C++: #include<stdio.h>
int main()
{
	int a[4],b[4],hi,bl,bca[4],bcb[4],c,j;
	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)){
		hi=0;
		bl=0;
		j=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}else{
				bca[j]=a[i];
				bcb[j]=b[i];
				j++;
			}
		}
		for(int i=0;i<j-1;i++){
			c=0;
			for(int k=0;k<j-1;k++){
				if(bca[i]==bcb[k]&&c==0){
					c=1;
					bl++;
				}
			}
		}
		printf("%d %d\n",hi,bl);
	}
	return 0;
}