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

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

int main(){

	std::array<int, 4> num_a, num;

	while(std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3]){
		std::cin >> num[0] >> num[1] >> num[2] >> num[3];
		int hit = 0, blow = 0;
		for(std::size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(std::size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;
	}

	return 0;
}

C++: #include <stdio.h>

bool d[12];

int a[4];
int b[4];

int main()
{
while(1 == scanf("%d",a))
{
for(int i = 1; i < 4; i++)
{
scanf("%d",a + i);
}
for(int i = 0; i < 4; i++)
{
scanf("%d",b + i);
}
for(auto& i : d)
{
i = false;
}
for(auto i : a)
{
d[i] = true;
}
int hi = 0;
int bu = 0;
for(int i = 0; i < 4; i++)
{
if(a[i] == b[i])
{
hi++;
}
else if(d[b[i]])
{
bu++;
}
}
}
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
using namespace std;

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

C++: #include <iostream>

using namespace std;

int main() {

	int a1, a2, a3, a4, b1, b2, b3, b4, h, b;

	cin >> a1 >> a2 >> a3 >> a4;

	while(cin >> b1 >> b2 >> b3 >> b4) {
		h=0;
		b=0;
		if(a1==b1)
			h++;
		if(a2==b2)
			h++;
		if(a3==b3)
			h++;
		if(a4==b4)
			h++;
		if(a1==b2||a1==b3||a1==b4)
			b++;
		if(a2==b3||a2==b4||a2==b1)
			b++;
		if(a3==b4||a3==b1||a3==b2)
			b++;
		if(a4==b1||a4==b2||a4==b3)
			b++;
		cout << h << " " << b << endl;
	}

	return 0;

}