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

C++: #include <iostream>

using namespace std;

int main() {
	int a[4], b[4];
	while (1) {
		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) {
			for (int j=0; j<4; ++j) {
				if (a[i] == b[j] && i == j) {
					hit ++;
				} else if (a[i] == b[j]) {
					blow ++;
				}
			}
		}

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

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

int main(){
	std::vector<int> a(4);
	std::vector<int> b(4);
	int hit_num;
	int blow_num;
	
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		hit_num = 0;
		blow_num = 0;
		for(int i = 0; i < 4; ++i){
			if(a[i] == b[i]) ++hit_num;
			for(int j = 0; j < 4; ++j){
				if(i != j && a[i] == b[j]) ++blow_num;
			}
		}
		std::cout << hit_num << " " << blow_num << std::endl;
	}
}

C++: #include<vector>
#include<iostream>
using namespace std;
int main() {
	int code[4], line, hit, bro;
	while (true) {
		hit = 0;
		bro = 0;
		for (int i = 0; i < 4; ++i) {
			cin >> code[i];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> line;
			if (code[i] == line) {
				++hit;
			}
			else {
				for (int i2 = 0; i2 < 4; ++i2) {
					if (code[i2] == line) {
						++bro;
					}
				}
			}
		}
		cout << hit << " " << bro << endl;
	}
	return 0;
}

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

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::array<int> A_num = {a1, a2, a3, a4};
		std::array<int> B_num = {b1, b2, b3, b4};
		
		int hit = 0;
		int blow = 0;

		for(int i = 0; i < 4; ++i){
			
			if(A_num[i] == B_num[i])
				hit++;
				
			count += std::count(A_num.begin(), A_num.end(), B_num[i]);

		}

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

		return 0;

}

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

using namespace std;

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

	int B,H;

	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		B = 0;
		H = 0;

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					B++;
				}
			}
		}

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

		cout << H << " " << B << endl;
	}

	return 0;
}

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

int main(){

	std::array<int, 4> A;
	while(std::cin >> A[0] >> A[1] >> A[2] >> A[3]){
		std::array<int, 4> B;
		std::cin >> B[0] >> B[1] >> B[2] >> B[3];
		
		int hit = 0;
		int blow = 0;
		for(int i=0; i<4; ++i){
			if( A[i] == B[i] )
				++hit;
			for(int j=i+1; j<4; ++j)
				if( A[i] == B[j] )
					++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]){
    for(int i=1;i<4;i++){
      cin>>a[i];
    }
    for(int j=0;j<4;j++){
      cin>>b[j];
    }
    int hit=0,blow=0;
    for(int i=0;i<4;i++){
      if(a[i]==b[i])hit++;
    }
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(i!=j){
	  if(a[i]==b[j]){
	    blow++;
	  }
	}
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }
  return 0;
}

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

int main() {
    int a1, a2, a3, a4, b1, b2, b3, b4;
    set<int> setA, setB;
    while (cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
        int hit = 0, blow = 0;
        if (a1 == b1) {
            hit++;
        }
        else {
            setA.insert(a1);
            setB.insert(b1);
        }
        if (a2 == b2) {
            hit++;
        }
        else {
            setA.insert(a2);
            setB.insert(b2);
        }
        if (a3 == b3) {
            hit++;
        }
        else {
            setA.insert(a3);
            setB.insert(b3);
        }
        if (a4 == b4) {
            hit++;
        }
        else {
            setA.insert(a4);
            setB.insert(b4);
        }

        for (int i = 1; i <= 9; ++i) {
            if (setA.count(i) && setB.count(i)) {
                ++blow;
            }
        }

        cout << hit << " " << blow << endl;
        setA.clear();
        setB.clear();
    }
}

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

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

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

        int blow = -hit;  // ヒットを除く
        std::sort(a.begin(), a.end());
        for (auto& v : b) {
            if ( std::binary_search(a.begin(), a.end(), v) ) ++blow;
        }

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

    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int hit=0,blow=0;
		rep(i,1,4) cin>>a[i];
		rep(i,0,4) cin>>b[i];
		rep(i,0,4){
			rep(j,i,4){
				if(a[i]==b[j]){
					if(i==j) hit++;
					else blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

C++: #include<stdio.h>
#include<math.h>

int main()
{
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (scanf("%d %d %d %d %d %d %d %d", &a1, &a2, &a3, &a4, &b1, &b2, &b3, &b4) != EOF)
	{
		int hit = 0, blow = 0;
		if (a1 == b1)hit++;
		if (a2 == b2)hit++;
		if (a3 == b3)hit++;
		if (a4 == b4)hit++;

		if (a1 == b2)blow++;
		if (a1 == b3)blow++;
		if (a1 == b4)blow++;
		if (a2 == b1)blow++;
		if (a2 == b3)blow++;
		if (a2 == b4)blow++;
		if (a3 == b1)blow++;
		if (a3 == b2)blow++;
		if (a3 == b4)blow++;
		if (a4 == b1)blow++;
		if (a4 == b2)blow++;
		if (a4 == b3)blow++;

		printf("%d %d\n", hit, blow);

	}
	return 0;
}