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

int main(){
	std::vector<int> A(4);
	std::vector<int> B(4);
	int a,b,c,d;
	while(std::cin>>a){
		A[0]=a;
		for(int i=1;i<4;++i)std::cin>>A[i];
		for(int i=0;i<4;++i)std::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]&&i==j)hit++;
				if(A[i]==B[j]&&i!=j)blow++;
			}
		}
		std::cout<<hit << " " << blow <<std::endl;
	}
	return 0;
}

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

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

  for(i=0; i<10; i++) appear[i]=0;
  while(cin>>a[0]){
    hit=0; blow=0;
    appear[a[0]]=1;
    for(i=1; i<4; i++){
      cin>>a[i];
      appear[a[i]]=1;
    }
    for(i=0; i<4; i++) cin>>b[i];

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

    for(i=1; i<4; i++) appear[a[i]]=0;
    printf("%d %d\n", hit, blow);
  }

  return 0;
}

C++: #include<iostream>

using namespace std;



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

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

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

int main(){
	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=0; j < 4; j++){
					if(a[i] == b[j] && i == j) hit++;
					if(a[i] == b[j] && i != j) blow++;
				}
		}
		cout << hit << ' ' << blow << endl;
	}
}

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;
		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>
#include<vector>
using namespace std;
int main(){
  vector<int> hit_anss;
  vector<int> bolor_anss;
  int nums_a[4],nums_b[4];
  int hit=0,bolor=0;
  while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){
    for(int i=0;i<4;i++){
      cin>>nums_b[i];
    }
    //hit????¢????
    for(int i=0;i<4;i++){
      if(nums_a[i]==nums_b[i])hit++;
    }
    //bolor????¢????
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j)continue;
        if(nums_a[i]==nums_b[j]){
          bolor++;
          break;
        }
      }
    }
    hit_anss.push_back(hit);
    bolor_anss.push_back(bolor);
  }
  for(int i=0;i<hit_anss.size();i++){
    cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl;
  }
}

C++: #include <set>
#include <array>
#include <iostream>

int main(){
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
    blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size())-num << std::endl;
    blowing.clear();
  }
  return 0;
}

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

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


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

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


}

C++: #include <iostream>

int hit(int x[],int y[]){
	int num = 0;
	for(int i = 0; i < 4; ++i){
		if(x[i] == y[i])
			++num;
	}
	return num;
}

int blow(int x[],int y[]){
	int num = 0;
	for(int i = 0; i < 4; ++i){
		for(int j = 0; j < 4;++j){
			if(x[i] == y[j])
				++num;
		}
	}
	return num - hit(x,y);
}

int checkDomain(int x[],int y[]){
	for(int i = 0; i < 4; ++i)
		if((x[i] / 10) != 0 || (y[i] / 10) != 0) return 0;
		
	return 1;
}

int checkNumber(int x[],int y[]){
	for(int i = 0; i < 4; ++i){
		for(int j = 0; j < 4; ++j){
			if(i != j && (x[i] == x[j] || y[i] == y[j])) return 0;
		}
	}
	return 1;
}

int main(){
	int a[4];
	int b[4];
	
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		std::cin >>b[0] >> b[1] >> b[2] >> b[3];
		if(checkDomain(a,b) && checkNumber(a,b)){
					std::cout << hit(a,b) << " " << blow(a,b) << std::endl;
		}
	}
	
}

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

int main() {
  int a[4], b[4];
  while (~scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3])) {
    scanf("%d%d%d%d", &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++;
        }
      }
    }
    printf("%d %d\n", hit, blow);
  }
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>

//#define PI 3.141592653589

using namespace std;



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

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

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

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<random>
using namespace std;

int main(){

  vector<int> a(4);
  vector<int> b(4);
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){

    vector<int> n(10, 0);
    int hit = 0;
    int blow = 0;
    for(int i=0; i<4; i++){
      if( a[i] == b[i] ){
        hit++;
        n[ a[i] ]--;
      }
    }

    for(int i=0; i<4; i++){
      n[ a[i] ]++;
      n[ b[i] ]++;
    }
    for(int i=0; i<10; i++){
      if( n[i] == 2 ) blow++;
    }

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

  return 0;
}




// EOF