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

int main(){
    int array[4][2] = {0};
    int hit = 0;
    int blow = 0;
    while (cin>>array[0][0]>>array[1][0]>>array[2][0]>>array[3][0]){
        cin >> array[0][1]>>array[1][1]>>array[2][1]>>array[3][1];
        hit = 0;
        blow = 0;
        for (int i = 0; i < 4; i++){
            if (array[i][0] == array[i][1]) {
                hit++;
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (array[i][0] == array[j][1]) {
                    if (array[i][0] != array[i][1]) {
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
        //printf("%d %d\n",hit,blow);
    }
    return 0;
}

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

int main(){
	int a[4], b[4];
	int hit, blow;
	char c;

	while (cin >> c){
		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 < 4; ++i){
			for (int j = i; j < 4; ++j){
				if (a[i] == b[j])
					++blow;
			}
		}

		for (int i = 0; i < 4; ++i){
			if (a[i] == b[i]){
				++hit;
				--blow;
			}
		}

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

	}
	return 0;
}

C++: #include<iostream>

using namespace std;
int main(){
    int a[4],b[4];
   
	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;
    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++;
    cout << hit << " " << blow << "\n";
    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]){
		cin >> b[0] >> b[1] >> b[2] >> b[3];
		
		int c[4], hit, blow;
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hit ++;
				c[i] = 1;
			}
		}
		
		for(int i = 0; i < 4; i++){
			if(c[i] == 1) continue;
			else{
				for(int j = 0; j < 4; j++){
					if(a[i] = b[j]){
						blow ++;
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}
}

C++: #include <iostream>
#include <array>
void counter(unsigned int* n_a,unsigned int* n_b,int* hit,int* blow);

int main() {

	std::array<unsigned int, 4> n_a;//selection of "A"
	std::array<unsigned int, 4> n_b;//selection of "B"

	while (std::cin) {
		std::cin >> n_a[0] >> n_a[1] >> n_a[2] >> n_a[3];
		std::cin >> n_b[0] >> n_b[1] >> n_b[2] >> n_b[3];

		int hit = 0;//factor and place are same
		int blow = 0;//only factor is same

		counter(n_a.data(),n_b.data(),&hit,&blow);

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

}

/*This function is a counter for "hit" and "blow".*/
void counter(unsigned int* n_a,unsigned int* n_b,int* hit,int* blow) {
	
	for (int i = 0; i < 4; ++i){
		for (int j = 0; j < 4; ++j){
			//the case of factor and place are same
			if (n_a[i] == n_b[j] && i == j) {
				*hit = *hit + 1;
			}
			//the case of only factor is same
			else if (n_a[i] == n_b[j]) {
				*blow = *blow + 1;
			}
			//otherwise
			else {
				//nothing to do
			}
		}
	}

}

C++: #include<stdio.h>

int main()
{
int p[4]={};
int q[4]={};
int x,H,B;
H=0;B=0;
for(int i=0;i<4;i++)
{scanf("%d",&x);p[i]=x;}
for(int i=0;i<4;i++)
{scanf("%d",&x);q[i]=x;}
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{if(p[i]==q[j]){
	if(i==j)H++;
    else if(i!=j)B++;
}}
printf("%d %d\n",H,B);
return 0;
}

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

C++: #include<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow,x,z;
	double stoped;
	
	
	while(scanf("%lf",&j)!=EOF){
		
		x=0,z=0;
		hit=0,brrow=0;
	
		for(i=0;i<4;i++){
			scanf("%d",&x);
			a[i]=x;
		}

		for(i=0;i<4;i++){
			scanf("%d",&z);
			b[i]=z;
		}

		for(i=0;i<4;i++){		//hit
			if(a[i]==b[i]){
				hit++;
			}
		}
	
		for(i=0;i<4;i++){		//brrow
			for(j=0;j<4;j++){
				if(a[i]==b[j] && i!=j){
					brrow++;
				}
			}
		}	
		printf("%d %d\n",hit,brrow);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void) {
  int A[4];
  int B[4];
  int blow;
  int hit;

  while(!cin.eof()) {
    blow = 0;
    hit = 0;


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

    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 <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (cin >> a1) {
		cin >> a2 >> a3 >> a4;
		cin >> b1 >> b2 >> b3 >> b4;
		
		vector<int> a(4), b(4);
		a.at(0) = a1;
		a.at(1) = a2;
		a.at(2) = a3;
		a.at(3) = a4;
		b.at(0) = b1;
		b.at(1) = b2;
		b.at(2) = b3;
		b.at(3) = b4;
		
		int hit = 0, blow = 0;
		for (int i = 0; i < 4; i++) {
			int n = b.at(i);
			int cnt = count(a.begin(), a.end(), n);

			if (cnt == 1) {
				if (a.at(i) == n) {
					hit++;
				}
				else {
					blow++;
				}
			}
		}

		cout << hit << ' ' << blow << endl;
	}
}

C++: #include <iostream>
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 k=0,n=0;
		for (int kk=0;kk<=3;kk++){
			if(a[kk]==b[kk]){
				k=k+1;
			}
		}
		for(int l=0;l<=3;l++){
			for(int m=0;m<=3;m++){
				if(a[l]==b[m]){
					n=n+1;
				}
		}}
		cout<<k<<" "<<n-k<<endl;
	}
	return 0;
}

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

int main(){
    int a[4];
    int b[4];

    int hit;
    int blow;

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

    return 0;
}