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 <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++)
            for (int j = 0; j < cards.size(); j++)
                if (i == j) {
                    if (cards[i] == other.cards[j])
                        hit++;
                } else if (cards[i] == other.cards[j])
                    blow++;
        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;
}

C++: #include <iostream>

using namespace std;

int main()
{
  int a1, a2, a3, a4;
  while(cin >> a1 >> a2 >> a3 >> a4){
    int a[4];
    int b[4];
    int H = 0, B = 0; 
    a[0] = a1;
    a[1] = a2;
    a[2] = a3;
    a[3] = a4;
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    for(int i = 0; i < 4; i++){
      for(int j = 0; j < 4; j++){
	if(b[i] == a[j]){
	  B++;
	  if(i == j){
	    B--;
	    H++;
	  }
	}
      }
    }
    cout << H << ' ' << B << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 0;
    int i = 0;
    while(cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i]) {
        n++; i++;
    };
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
 int a[4],b[4],h,bb,i;
 while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
  h=bb=0;
  for(i=0;i<4;i++)if(a[i]==b[i])h++;
  sort(a,a+4);sort(b,b+4);
  for(i=0;i<4;i++)if(find(b,b+4,a[i])!=b+4)bb++;
  bb -= h;
  cout<<h<<" "<<bb<< endl;
 }
}

C++: #include <iostream>

using namespace std;

int main() {

	int A, a[4] = {}, b[4] = {};

	for (int t = 0; t < 50; t++) {
		int hit = 0, blow = 0;
		cin >> A;
		if (cin.eof()) {
			break;
		}
		else {
			a[0] = A;
			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[j]) {
						if (i == j) {
							hit++;
						}
						else {
							blow++;
						}
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		bool blowlist[10];
		for(auto& i : blowlist)
			i = false;

		int b[4];
		for(auto& i : a)
		{
			cin >> i;
			blowlist[i] = true;
		}
		for(auto& i : b)
			cin >> i;

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

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

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a[4];
	int b[4];
	int i,j;
	int hit,blow;
	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
	    scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		hit=0;
		blow=0;
		for(i=0;i<4;i++){
			if(a[i]==b[i]){
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					blow++;
				}
			}
		}
		blow=blow-hit;
		printf("%d %d",hit,blow);
	}
	return 0;
}

C++: #include <iostream>

#define SIZE 4

using namespace std;

int main() {
	int a[SIZE], b[SIZE], hit, blo;

	while (cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]) {
		hit = 0;
		blo = 0;
		for (int i = 0; i < SIZE; i++) {
			if (a[i] == b[i]) {
				hit++;
				a[i] = 10;
				b[i] = 10;
			}
		}

		for (int i = 0; i < SIZE; i++) {
			for (int j = i + 1; j < SIZE; j++) {
				if (a[i] == 10 || b[j] == 10) {
					continue;
				}

				if (a[i] == b[j]) {
					a[i] = 10;
					b[i] = 10;
					blo++;
				}
			}
		}
		cout << hit << " " << blo << endl;
	}

	return 0;
}

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

int main() {
  int a[4],b[4];
  while(cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    int h=0, bl=0;
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    for(int i=0; i<4; i++) {
      if(a[i]==b[i]) h++;
      else {
	if(find(a, a+4, b[i])!=a+4) bl++;
      }
    }
    cout << h << " " << bl << endl;
  }
  return 0;
}

C++: 
#include<iostream>
#include<stdio.h>
#include<algorithm>

using namespace std;

int main(){
	pair<int,int>  p1,p2,p3,p4;
	int a[4];
	int b[4];

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]) != EOF){
		int hit = 0;
		int blow = 0;
		//scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);

		for(int i=0;i<4;i++){
			scanf("%d",&b[i]);
				if(a[i] == b[i]){
					hit++;
				}
				for(int j=0;j<4;j++){
						if(b[i] == a[j] and a[i] != b[i]){
							blow++;
						}
				}
		}
	cout << hit << " " << blow << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
  vector<int> a(4),b(4);
  while(cin>>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++){
      if(a[i]==b[i]){
        hit++;
        a[i]=b[i]=0;
      }
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(a[i]==0)continue;
        if(a[i]==b[j]){
          blow++;
          break;
        }
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }

}

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",hit,brow);
        puts("");
    }
    
    return 0;
}