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++: #include<iostream>
using namespace std;

int main(void){
  int a[4];
  int b[4];
  int count=0;
  int hit=0;
  int blow=0;

  cin >> a[0] >> a[1] >> a[2] >> a[3];
  cin >> b[0] >> b[1] >> b[2] >> b[3];

  for(int i=0; i<3; i++){
    for(int j=i+1; j<4; j++){
      if(a[i] == a[j]){
        cout << "異なる数字を入力してください。" << endl;
        count++;
      }
      if(b[i] == b[j]){
        cout << "異なる数字を入力してください。" << endl;
        count++;
      }
    }
  }
  if(count==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++;
          }
        }
      }
    }
    cout << hit << "hit " << blow << "blow" << endl;
  }

  return 0;
}

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

int main(){
	std::array < int, 4>a;
	std::array < int, 4>b;
	
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		int hit, blow;
		hit = blow = 0;
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		for(int i=0; i<4; ++i){
			if(a[i] == b[i]){
				++hit;
			} else{
				for(int j=0; j<4; ++j){
					if(a[i] == b[j]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << ' ' << blow << std::endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(){
    int a[4];
    int b[4];
    int used[10];
    int hits, blows;
    
    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]);
        hits = blows = 0;
        for (int i=0; i<10; i++) used[i]=0;
        for (int i=0; i<4; i++) used[a[i]]++;
        for (int i=0; i<4; i++){
            if (used[b[i]]){
                if (b[i] == a[i]) hits++;
                else blows++;
            }
        }
        printf("%d %d\n", hits, blows);
    }
    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]){
	hit=0;
	blow=0;
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>
#include<array>

int main(){
    std::array<int, 4> a;
    std::array<int, 4> b;
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        std::cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hit = 0, blow = 0;
        for(int i = 0; i < a.size(); ++i){
            for(int j = 0; j < b.size(); ++j){
                if(a[i] == b[j] && i == j)
                    ++hit;
                else if (a[i] == b[j])
                    ++blow;
            }
        }
          std::cout << hit << " " << blow << std::endl;
    }
      return 0;
}

C++: #include<iostream>
using namespace std;
#include<cstdio>
int main(){
  int hit,blow;
  int a[4],b[4];
  while(scanf("%d",&a[0])!=EOF){
    hit=0;
    blow=0;
    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++;
	b[i]=11;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(a[i]==b[j])blow++;
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }
}

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

int main()
{
 int a[4];
 int b[4];
 while(cin>>a[0]>>a[1]>>a[2]>>a[3])
 {
   for(int i=0; i<4; i++)
   
   cin>>b[i];
   int hit=0;
   int blow=0;
   for(int i=0;i<4;i++)
   {
     if(a[i]==b[i])
     {
     hit++;
     else
     {
       for(int j=0;j<4;j++)
       if(a[i]==b[j])
       {
       blow++; 
       }
      }
     }
    }
   cout<<hit<<" "<<blow<<endl;
 }
   return 0;
}

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

C++: #include <cstdio>

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

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

int main(){
  int a[4],c[4];
  while(1){
    int e=0,b=0;
    for(int i=0;i<4;i++)
      cin >> a[i];
    for(int i=0;i<4;i++)
      cin>> c[i];
    for(int i=0;i<4;i++)
      for(int j=0;j<4;j++)
	if(a[i]==c[j]){
	  if(i==j)e++;
	  else b++;
	}
    cout<<e<<' '<<b<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;

int main(){
	while(true){
		map<int,int> A;
		for(int i = 0 ; i < 4 ; i++){
			int x;
			if(!(cin >> x))exit(0);
			A[x] = i;
		}
		int h=0,b=0;
		for(int i = 0 ; i < 4 ; i++){
			int x;
			cin >> x;
			if( A.count(x) ){
				if( A[x] == i ) h++;
				else b++;
			}
		}
		cout << h << " " << b << endl;
			

		
	}
}

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <queue>
#include <string>
#include <map>
#include <vector>

using namespace std;

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

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