Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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;
}

C++: #include <iostream>
#include <sstream>
#include <string>

int a[4], b[4];

void split(std::string s, std::string t) {
    a[0] = s[0]-'0'; b[0] = t[0]-'0';
    a[1] = s[2]-'0'; b[1] = t[2]-'0';
    a[2] = s[4]-'0'; b[2] = t[4]-'0';
    a[3] = s[6]-'0'; b[3] = t[6]-'0';
}

void solve() {
    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++;
                }
            }
        }
    }
    std::cout << hit << ' ' << blow << std::endl;
}

int main(void) {
    std::string line_1, line_2;
    while (std::getline(std::cin, line_1)) {
        std::getline(std::cin, line_2);
        split(line_1, line_2);
        solve();
    }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		vector <int> A(4);
		vector <int> B(4);

		for ( int i = 0; i < 4; i++ )
		{
			cin >> A[i];
		}

		for ( int i = 0; i < 4; i++ )
		{
			cin >> B[i];
		}

		if ( cin.eof() )
			break;

		int blow = 0;
		for ( vector <int>::iterator it = B.begin(); it != B.end(); it++ )
		{
			if ( find( A.begin(), A.end(), *it ) != A.end() )
			{
				blow ++;
			}
		}

		vector <int>::iterator it_a = A.begin();
		vector <int>::iterator it_b = B.begin();

		int hit = 0;
		while ( it_a != A.end() )
		{
			if ( *it_a == *it_b )
				hit++;
			it_a++;
			it_b++;
		}

		blow -= hit;

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

	}

	return 0;
}

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

int main(){
	int a1, a2, a3, a4;
	int b1, b2, b3, b4;
	int hit = 0;
	int blow = 0;

	while(cin >> a1 >> a2 >> a3 >> a4){
		cin >> b1 >> b2 >> b3 >> b4;

		hit = 0;
		blow = 0;


		if(a1 == b1){
			hit++;
		}
		if(a2 == b2){
			hit++;
		}
		if(a3 == b3){
			hit++;
		}
		if(a4 == b4){
			hit++;
		}
		if(a1 == b2 || a1 == b3 || a1 == b4){
			blow++;
		}
		if(a2 == b1 || a2 == b3 || a2 == b4){
			blow++;
		}
		if(a3 == b1 || a3 == b2 || a3 == b4){
			blow++;
		}
		if(a4 == b1 || a4 == b2 || a4 == b3){
			blow++;
		}

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

}