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<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
  int a[4],b[4];
  int hit,blow;
  while(cin >> a[0]){
    for(int i=1;i<4;i++)cin >> a[i];
    for(int i=0;i<4;i++)cin >> b[i];
    hit = blow = 0;
    for(int i=0;i<4;i++){
      if(a[i] == b[i])hit++;
      for(int j=0;j<4;j++){
	if(i != j && a[i] == b[j])blow++;
      }
    }
    cout << hit << ' ' << blow << endl;
  }
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	vector<int> a(4);
	vector<int> b(4);

	string sa;
	for (; getline(cin, sa);)
	{
		stringstream ssa;
		ssa << sa;

		for (int i = 0; i < 4; i++)
		{
			ssa >> a.at(i);
		}

		string sb;
		getline(cin, sb);
		stringstream ssb;
		ssb << sb;

		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++)
		{
			ssb >> b.at(i);
			if (a.at(i) == b.at(i))
			{
				hit++;
			}
		}

		sort(a.begin(), a.end());
		sort(b.begin(), b.end());

		for (int i = 0; i < 4; i++)
		{
			if (a.at(i) == b.at(i))
			{
				blow++;
			}
		}

		blow -= hit;
		if (blow < 0)
		{
			blow = 0;
		}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a[4],b[4],b1=0,b2=0,hit=0,boro=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(i==j&&a[i]==b[j]){
                    b1=0;b2=1;
                    break;
                }
                if(a[i]==b[j])b1=1;
            }
            hit+=b2;boro+=b1;
            b1=0;b2=0;
        }
        cout<<hit<<" "<<boro<<endl;
        hit=0;boro=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];
  while(cin>>nums_a[0]>>nums_a[1]>>nums_a[2]>>nums_a[3]){
    int hit=0,bolor=0;
    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++: // 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; 
	}
}

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

int main(void){
  vector<int> a(4);
  vector<int> b(4);

  while(cin>>a[0]){
    int va[10] = {0};
    int vb[10] = {0};
    for(int i = 1 ; i < 4 ; i ++){
      cin>>a[i];
      va[--a[i]]++;
    }
    int hit = 0;
    for(int i = 0 ; i < 4 ; i ++){
      cin>>b[i];
      if(a[i] == b[i])hit++;
      vb[--b[i]]++;
    }
    int blow = 0;
    for(int i = 0 ; i < 10 ; i ++){
      blow += min(va[i],vb[i]);
    }
    cout<<hit<<blow-hit<<endl;
  }
}

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

using namespace std;

void check_num(array<int,8> a){
  int hit_num=0,blow_num=0;
  for(int i=0;i<4;i++){
    for(int j = 4;j<8;j++){
      if(a[i] == a[j]){
        if(j-4 == i){
          ++hit_num;
        }else{
          ++blow_num;
        }
      }
    }
  }

  cout<<hit_num<<" "<<blow_num<<endl;
}

int main(void){
  array<int,8> a; //プレイヤーa,bの値
  int input;

  while(cin >> input){
    a[0]=input;
    for(int i = 1;i<8;i++){
      cin >>a[i];
    }
    check_num(a);
  }

  return 0;
}

C++: #include <stdio.h>

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

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

int main(void){

  int a,hit = 0,blow = 0;
  vector<int> A(4,0),B(4,0);

  while(cin >> a){

    A[0] = a;
    for(int i = 1;i < 4 ;i++){
      cin >> A[i];
    }
    for(int i = 0;i < 4;i++){
      cin >> B[i];
      if(A[i] == B[i]){
          hit++;
      }
      for(int j = 0;j < 4;j++){
        if(B[i] == A[j] && i != j){
          blow++;
        }
      }
    }
    cout << hit << " " << blow << endl;
    hit = 0;blow = 0;
  }



    return 0;
}

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

C++: #include <iostream>
int main()
{

	while (1) {
		int a[4], b[4];
		int eat = 0, bite = 0;
		for (int i = 0; i < 4; i++) {
			std::cin >> a[i];
		}
		if (a[0] == 0) {
			break;
		}
		for (int i = 0; i < 4; i++) {
			std::cin >> b[i];
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j&&a[i] == b[j]) {
					eat++;
				}
				else if (a[i] == b[j]) {
					bite++;
				}
			}
		}
		std::cout << eat << " " << bite << std::endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {

	int A[4], B[4];

	while (true) {
		for (int& a : A) {
			cin >> a;
		}
		for (int& b : B) {
			cin >> b;
		}
		if (cin.eof()) {
			break;
		}
		int hitCount = 0;
		int blowCount = 0;
		for (int i = 0; i < 4; ++i) {
			if (A[i] == B[i]) {
				++hitCount;
			}
			else {
				for (int j = 0; j < 4; ++j) {
					if (A[i] == B[j]) {
						++blowCount;
					}
				}
			}
		}
		cout << hitCount << ' ' << blowCount << endl;
	}
	return 0;
}

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

using namespace std;

int a[4], b[4];

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;

int main ()
{
	int a[5], b[5], i, j, x, y;
	while (~scanf ("%d%d%d%d", a, a+1, a+2, a+3))
	{
		x = y = 0;
		for (i = 0; i < 4; i++) scanf ("%d", b+i);
		for (i = 0; i < 4; i++)
		{
			if (a[i] == b[i]) ++x;
			for (j = i+1; j < 4; j++)
				if (a[i] == b[j])
					++y;
		}
		printf ("%d %d\n", x, y);
	}
    return 0;
}