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[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		bool blowlist[10];
		for(auto& i : blowlist)
			i = false;

		int b[4];
		for(auto& i : a)
		{
			cin >> i;
			blowlist[i] = true;
		}
		for(auto& i : b)
			cin >> i;

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

		cout << hit << ' ' << blow << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a[4];
	int 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++){
			if(a[i]==b[i]){
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					blow++;
				}
			}
		}
		blow=blow-hit;
		printf("%d %d",hit,blow);
	}
	return 0;
}

C++: #include <iostream>

#define SIZE 4

using namespace std;

int main() {
	int a[SIZE], b[SIZE], hit, blo;

	while (cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]) {
		hit = 0;
		blo = 0;
		for (int i = 0; i < SIZE; i++) {
			if (a[i] == b[i]) {
				hit++;
				a[i] = 10;
				b[i] = 10;
			}
		}

		for (int i = 0; i < SIZE; i++) {
			for (int j = i + 1; j < SIZE; j++) {
				if (a[i] == 10 || b[j] == 10) {
					continue;
				}

				if (a[i] == b[j]) {
					a[i] = 10;
					b[i] = 10;
					blo++;
				}
			}
		}
		cout << hit << " " << blo << endl;
	}

	return 0;
}

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

int main() {
  int a[4],b[4];
  while(cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    int h=0, bl=0;
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    for(int i=0; i<4; i++) {
      if(a[i]==b[i]) h++;
      else {
	if(find(a, a+4, b[i])!=a+4) bl++;
      }
    }
    cout << h << " " << bl << endl;
  }
  return 0;
}

C++: 
#include<iostream>
#include<stdio.h>
#include<algorithm>

using namespace std;

int main(){
	pair<int,int>  p1,p2,p3,p4;
	int a[4];
	int b[4];

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]) != EOF){
		int hit = 0;
		int blow = 0;
		//scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);

		for(int i=0;i<4;i++){
			scanf("%d",&b[i]);
				if(a[i] == b[i]){
					hit++;
				}
				for(int j=0;j<4;j++){
						if(b[i] == a[j] and a[i] != b[i]){
							blow++;
						}
				}
		}
	cout << hit << " " << blow << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
  vector<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++){
      if(a[i]==b[i]){
        hit++;
        a[i]=b[i]=0;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(a[i]==0)continue;
        if(a[i]==b[j]){
          blow++;
          break;
        }
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }

}

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

int main()
{
    int ans_a[100],ans_b[100];
    int hit=0,brow=0;
    
    while (cin>>ans_a[0]>>ans_a[1]>>ans_a[2]>>ans_a[3]>>ans_b[0]>>ans_b[1]>>ans_b[2]>>ans_b[3]) {
        for (int i=0; i<4; i++) {
            for (int j=0; j<4; j++) {
                if (ans_a[i]==ans_b[j]&&i==j) {
                    hit++;
                }
                else if(ans_a[i]==ans_b[j]) {
                    brow++;
                }
            }
        }
        printf("%d %d",hit,brow);
        puts("");
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

int bucket[10];
int a[4], b, hit, blow;

int main()
{
	
	do
	{
		memset(bucket, 0, sizeof(bucket));
		hit = 0; blow = 0;
		
		for(int i = 0; i < 4; i++)
		{
			cin >> a[i];
			bucket[a[i]] = 1;
		}
		
		for(int i = 0; i < 4; i++)
		{
			cin >> b;
			if( b == a[i] )
				hit++;
			else if( bucket[b] )
				blow++;
		}
		
		cout << hit << " " << blow << endl;	
		
	}while(!cin.eof());
	
	return 0;
}

C++: // 0025 Hit and Blow
#include<iostream>
using namespace std;

int main()
{
	int a[4];
	int b[4]; 
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ 
	  int hit  =0;
	  int 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(a[i]==b[j])
				if(i==j)	
					hit++;
				else
					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 count[2]={0};
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i==j && a[i] == b[j]){
					count[0]++;
				}
				if(i!=j && a[i] == b[j]){
					count[1]++;
				}
			}
		}
		cout << count[0] << " " << count[1] << endl;
	}
}

C++: #include<iostream>
int main() {
	int input[4];
	for (int i = 0; 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 <string>
using namespace std;

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

	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		hit = 0;
		blow = 0;
		for(int i=0 ; i<10 ; i++){
			n1[i] = 0;
			n2[i] = 0;
		}

		for(int i=0 ; i<4 ; i++){
			if(a[i]==b[i]) hit++;
			n1[ a[i] ] = 1;
			n2[ b[i] ] = 1;
		}
		for(int i=0 ; i<10 ; i++){
			if( n1[i]==n2[i] && n1[i]==1) blow++;
		}
		cout << hit << " " << blow-hit << endl;
	}
}

C++: #include <cstdio>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int a[4],b[4];
  while(1){
  rep(i,4)cin >> a[i];
  rep(i,4)cin >> b[i];
  if(cin.eof())break;

  int blow=0,hit=0;

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

}

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

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

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	bool num[10];
	int a[4],b[4],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<10;i++){
			num[i]=false;
		}
		for(int i=0;i<4;i++){
			num[a[i]]=true;
		}
		for(int i=0;i<4;i++){
			if(b[i]==a[i])hit++;
			else if(num[b[i]])blow++;
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}