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>

int A[4];
int B[4];
int main()
{
  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]) != EOF){
  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++;
      }
    }
  }
    printf("%d %d\n",Hit,Blow);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    for(int i = 0;i < 50;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] 
            >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i] ;
        int t = 0;
        for(int j = 0;j < 4;j++){
            if(a[j][i] != 0){
                t = 1;
                j = 4;
            }
            if(b[j][i] != 0){
                t = 1;
                j = 4;
            }
        }
        if (t == 0){
            n = i;
            i = 50;
        }
    } 
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

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

C++:     #include <iostream>
    using namespace std;
     
    int main() {
    string a,b;
    while(getline(cin,a),getline(cin,b)){
    int hit=0,blow=0;
    for(int i=0;i<a.size();i+=2){
    if(a[i]==b[i]){
    hit++;
    }else if(b.find(a[i],0)!=string::npos){
    blow++;
    }
    }
    cout<<hit<<" "<<blow<<endl;
    }return 0;
    }

C++: #include <iostream>
#include <vector>

int main(void){
	int a,b,c,d;
	std::vector<int> num;

	while(std::cin >> a >> b >> c >> d){
		num.push_back(a);
		num.push_back(b);
		num.push_back(c);
		num.push_back(d);
	}
	
	int hit,blow;
	for(int i = 0; i < (int)num.size(); i += 8){
		hit = 0, blow = 0;
		for(int j = 0; j < 4; ++j){
			for(int k = -j; k < -j+4; ++k){
				if(k == 0){
					if(num[i+j+4] == num[i+j+k]){
						++hit;
					}
				}else{
					if(num[i+j+4] == num[i+j+k]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include <iostream>

int main() {
	const int size = 4;
	int a[size], b[size];
	int hit = 0, blow = 0;

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

		std::cout << hit << " " << blow << std::endl;
	}
}

C++: //ヒットアンドブロー
#include<cstdio>

using namespace std;

int main(void){
	int hit,blow,i,j;
	int a[4],b[4];

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==4){
		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 <iostream>
using namespace std;

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

	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++){
			if (a[i] == b[i]) hit++;
		}

		for (int i = 0; i < 4; i++){
			for (int j = 0; j < 4; j++){
				if (a[i] == b[j]) blow++;
			}
		}
		blow -= hit;

		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a[4];
int b[4];
int hit=0,blow=0;
while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
cin>>b[0]>>b[1]>>b[2]>>b[3];
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(a[i]==b[j])blow++;}}
blow-=hit;
cout<<hit<<" "<<blow<<endl;}}

C++: #include <iostream>

using namespace std;

int main() {
	int size = 4;
	int ina[size];
	int inb[size];
	int hit=0, blow=0;
	while(true){
		cin>>ina[0]>>ina[1]>>ina[2]>>ina[3];
		cin>>inb[0]>>inb[1]>>inb[2]>>inb[3];
		if(cin.eof()) break;
		for(int i=0; i<size; i++) {
			if(ina[i] == inb[i]) hit++;//cout<<"check a:"<<ina[i]<<" b:"<<inb[i]<<endl;
			for(int j=0; j<size; j++){
				if(i==j) continue;
				//cout<<"check a:"<<ina[i]<<" b:"<<inb[j]<<endl;
				if(ina[i] == inb[j]) blow++;
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a[4], 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;
		for(int i = 0; i < 4; ++i){
			if(a[i] == b[i]){
				hit++;
			}
		}

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

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int a[4],b[4];
	for(;cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3];){
		int x=0,y=0;
		rep(i,4)if(a[i]==b[i])x++;
		rep(i,4)rep(j,4)if(i!=j&&a[i]==b[j])y++;
		printf("%d %d\n",x,y);
	}
	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 = 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;
}