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>
int main(){
	int a[4],b[4],i,n,hit,blow;
	
		while(std::cin>>a[0]){
		hit=0;
		blow=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;
	
	
	}

C++: #include<cstdio>

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

C++: #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
    int a[4],b[4];
    int d[10];
    int n,m;
    while(scanf("%d",&a[0])!=EOF)
    {
        n=m=0;
        memset(d,0,sizeof(d));
        d[a[0]]++;
        for(int i=1; i<4; i++)
        {
            scanf("%d",&a[i]);
            d[a[i]]++;
        }
        for(int i=0; i<4; i++)
        {
            scanf("%d",&b[i]);
            if(a[i]==b[i])
                n++;
            else
            {
                d[b[i]]++;
                if(d[b[i]]==2)
                    m++;
            }
        }
        printf("%d %d\n",n,m);
    }
    return 0;
}

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

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

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

int main(){
	std::array<int, 4> a;
	std::array<int, 4> b;
	int hit = 0;
	int blow = 0;

	while(true){
		std::cin >> a[0] >> a[1] >> a[2] >> a[3];
		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] && i != j){
						++blow;
					}
				}
			}
		}

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

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

int main() {
	vector<int> a(4), b(4);
   
	while(true){
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) 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 : blow ) += 1;	
				}
			}
		}
		cout << hit << ' ' << blow << endl;
		if(cin.eof()) break;
	}
}

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

int main(){
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (std::cin >> a1 >> a2 >> a3 >> a4) {
		std::cin >> b1 >> b2 >> b3 >> b4;
		std::vector<int> a = {a1, a2, a3, a4};
		std::vector<int> b = {b1, b2, b3, b4};
		int hit = 0, blow = 0;
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (a.at(i) == b.at(j)) {
					if (i == j) {
						++hit;
					} else {
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;

	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int a[4];
	int b[4];

	while(cin >> a[0] >> a[1] >> a[2] >> a[3]) {
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		int hit = 0, brow = 0;
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				hit++;
			}
		}
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[(i + 1) % 4]) {
				brow++;
			}
			if(a[i] == b[(i + 2) % 4]) {
				brow++;
			}
			if(a[i] == b[(i + 3) % 4]) {
				brow++;
			}
		}
		cout << hit << " " << brow << endl;
	}

	return 0;
}

C++: #include<iostream>
int main()
{
    int hit[4]={},blow[4]={};
    while(cin>>hit[0]){
        int ans1=0,ans2=0;
        for(int i=1; i<4; i++){
            cin>>hit[i];
        }
        for(int i=0; i<4; i++){
            cin>>blow[i];
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(hit[i]==blow[j]){
                    (i==j)?ans1++:ans2++;
                }
            }
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){

  int a[4],b[4],n,m;

  while(cin >> a[0]){
    n = 0;
    m = 0;
    cin >> a[1] >> a[2] >> a[3];
    for(int i=0;i<4;i++){
      cin >> b[i];
      if(a[i] == b[i]) n++;
    }
    sort(a,a+4);
    for(int i=0;i<4;i++){
      if(*lower_bound(a,a+4,b[i])==b[i]) m++;
    }
    cout << n << " " << (m-n) << endl;
  }
  return (0);
}

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

using namespace std;

int main()
{
	int numa[4];
	int numb[4];
	int a, i, j;
	int hit, blow;
	

	while(cin >> numa[0] >> numa[1] >> numa[2] >> numa[3] >> numb[0] >> numb[1] >> numb[2] >> numb[3] )
	{	
		hit = 0;
		blow = 0;
		
		for(i = 0; i < 4; i++)
		{
			if(numa[i] == numb[i])
			{
				hit = hit + 1;
			}
				for(j = 0; j < 4; j++)
				{
					if(numa[i] == numb[j] && i != j)
					{
						blow = blow + 1;
					}		
				}
		}
		cout << hit << " " << blow << endl;
	}
		
	return 0;
		
}

C++: #include <stdio.h>

int main(){
  int a[4], b[4];
  while(scanf("%d%d%d%d%d%d%d%d", a,a+1,a+2,a+3,b,b+1,b+2,b+3)!=EOF){
    int x[10];
    int i;
    for(i=0;i<10;i++) x[i] = 0;

    for(i=0;i<4;i++) x[a[i]] = i+1;

    int hit=0, blow=0;

    for(i=0;i<4;i++){
      if(x[b[i]]){
        if(x[b[i]] == i+1) hit++;
        else blow++;
      }
    }
    printf("%d %d\n", hit, blow);
  }
}

C++: #include <cstdio>
int a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;}

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

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

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

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