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(){
    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>

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 (i==j&&a[i]==b[j]) hit++;
				else if (a[i]==b[j]) blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
}

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

int main(){

  int n, hit, blow, b[4];
  int a[10][2] = {0};

  while(cin >> b[0] >> b[1] >> b[2] >> b[3]){
    hit = 0;
    blow = 0;
    for(int i=1; i<=4; i++){
      a[b[i-1]][1] = i;
    }

    for(int i=1; i<=4; i++){
      cin >> n;
      if(a[n][1] == i) hit++;
      else if(a[n][1] != 0) blow++;
    }
    cout << hit << " " << blow << endl;    
  }

  return 0;

}

C++: 
#include <iostream>

using namespace std;

int main() {
    while(true) {
        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];
        if(cin.eof()) break;

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

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

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

int main()
{

	int a[4],b[4];
	int hit = 0,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<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 -= hit;	
	cout << hit << " " << blow << endl;

	return 0;
}

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

int main()
{
	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])
	{
		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++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#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 ht = 0, bl = 0;
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i])
				ht++;
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i != j && a[i] == b[j])
					bl++;
			}
		}
		printf("%d %d\n", ht, bl);
	}
	return 0;
}

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

int main(){
  int a[4];
  int b[4];
  int appear[10];
  int i;
  int hit, blow;

  for(i=0; i<10; i++) appear[i]=0;
  while(cin>>a[0]){
    hit=0; blow=0;
    appear[a[0]]=1;
    for(i=1; i<4; i++){
      cin>>a[i];
      appear[a[i]]=1;
    }
    for(i=0; i<4; i++) cin>>b[i];

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

    for(i=0; i<4; i++) appear[a[i]]=0;
    printf("%d %d\n", hit, blow);
  }

  return 0;
}

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(n=0;n<4;n++){
	std::cin>>b[n];
	}
	hit=0;
	blow=0;

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

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

return 0;
}

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

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

	while (cin >> a.at(0)) {
		int hit = 0, brow = 0;

		for (int i = 1; i < 4; i++) {
			cin >> a.at(i);
		}
		for (int j = 0; j < 4; j++) {
			cin >> b.at(j);
		}

		for (int k = 0; k < 4; k++) {
			for (int l = 0; l < 4; l++) {
				if (a.at(k) == b.at(l)) {
					if (k == l) {
						hit++;
					}
					else {
						brow++;
					}
				}
			}
		}

		cout << hit << " " << brow << endl;
	}

	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	int a[4], b[4];
	while(cin>>a[0]){
		cin>> a[1]>> a[2]>> a[3]>> b[0]>> b[1]>> b[2]>> b[3];
		int ans1 = 0;
		int ans2 = 0;
		for(int i=0;i<4;i++){
			if(a[i] == b[i]) ans1++;
			for(int j=0;j<4;j++){
				if(a[i] == b[j]) ans2++;
			}
		}
		ans2 -= ans1;
		cout<< ans1<< " "<< ans2<< endl;
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: while gets
a=$_.split.map(&:to_i)
b=gets.split.map(&:to_i)
c,d=0,0;
4.times{|i|
if a[i]==b[i] then
c+=1
else
d+=1 if b.find{|j|j==a[i]}
end
}
print c," ",d,"\n"
end

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

int main()
{
    int ans_a[100],ans_b[100];
    int hit=0,brow=0;
    
    while (cin>>ans_a[0]>>ans_a[1]>>ans_a[2]>>ans_a[3]>>ans_b[0]>>ans_b[1]>>ans_b[2]>>ans_b[3]) {
        for (int i=0; i<4; i++) {
            for (int j=0; j<4; j++) {
                if (ans_a[i]==ans_b[j]&&i==j) {
                    hit++;
                }
                else if(ans_a[i]==ans_b[j]) {
                    brow++;
                }
            }
        }
        printf("%d %d\n",hit,brow);
    }
    
    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],!cin.eof()){
        int hit=0,blow=0;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(b[i]==a[j] && i==j){
                    hit++;
                    break;
                }
                if(b[i]==a[j] && i!=j){
                    blow++;
                    break;
                }
            }
        }
        cout<<hit<<' '<<blow<<endl;
    }

    return 0;
}