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 <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++;
                }
            }
        }
        cout<<hit<<brow<<endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int h=0,r=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])
			h++;
		for(int j=0;j<4;j++){
			if(a[j]==b[i])
				r++;
		}
	}
	r-=h;
	cout<<h<<" "<<r<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
int hit, blow;
string a, b;
int main(){
	while(getline(cin, a)){
		getline(cin, b);
		hit = 0;
		blow = 0;
		for(int i = 0; i < 7; i += 2){
			if(b[i] == a[i]){
				hit++;
			}
			else if(a.find(b[i]) != -1){
				blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

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

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

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

	while(~scanf("%d %d %d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&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(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;
    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 <stdio.h>
int main(){
int a[4],b[4],x,y;
while(scanf("%d%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])!=EOF){
x=y=0;
for(int i=0;i<4;i++){
if(a[i]==b[i])x++;
else if(a[i]==b[(i+1)%4]||a[i]==b[(i+2)%4]||a[i]==b[(i+3)%4])y++;
printf("%d %d\n",x,y);
}
}}

C++: #include<iostream>

int main(){
	int a[4],b[4],i,n,hit=0,blow=0;


	while(std::cin>>a[0]){

	for(i=0;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 <iostream>
#include <array>

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

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

    return 0;
}

C++: #include<iostream>
int main() {
	int n;
	while (std::cin>>n) {
		int input[4];
		input[0] = n;
		for (int i = 1; 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 <cstring>
using namespace std;

int main()
{
	int t,h,b,n[10];
	while(cin >> t)
	{
		memset(n,0,sizeof(n));

		n[t]=1; h=b=0;
		for(int i=1; i<4; i++)
		{
			cin >> t;
			n[t] = i+1;
		}

		for(int i=0; i<4; i++)
		{
			cin >> t;
			if(n[t]==i+1)    h++;
			else if(n[t]!=0) b++;
		}

		cout << h << " " << b << endl;
	}
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    while (1)
    {
        vector<int> a(4), b(4);
        rep(i, 4)
        {
            cin >> a[i];
        }

        rep(i, 4)
        {
            cin >> b[i];
            if (cin.eof())
                return 0;
        }

        int hit = 0, blow = 0;

        rep(i, 4)
        {
            if (a[i] == b[i])
            {
                hit++;
            }
            else if (find(ALL(a), b[i]) != a.end())
            {
                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 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;
  }
}

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

struct HitAndBlow
{
    vector<int> cards;

    HitAndBlow(){
        cards = vector<int>(4);
    }

    void board(const HitAndBlow &other) const {
        int hit = 0, blow = 0;
        for (int i = 0; i < cards.size(); i++) {
            if (cards[i] == other.cards[i]) {
                hit++;
                continue;
            }
            for (int j = 0; j < cards.size(); j++)
                if (cards[i] == other.cards[j]) {
                    blow++;
                    break;
                }
        }
        cout << hit << " " << blow << endl;
    }
};

istream &operator >> (istream &is, HitAndBlow &g)
{
    for (int i = 0; i < g.cards.size(); i++)
        is >> g.cards[i];
    return is;
}

int main()
{
    for (HitAndBlow braker, maker; cin >> braker >> maker;)
        maker.board(braker);

    return 0;
}