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<stdio.h>
int main(void)
{
	int i,j;
	int hit,blow;
	int dataA[4],dataB[4];

	while(scanf("%d",&dataA[0])!=EOF) {

		hit=0;
		blow=0;

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

		for(i=0;i<4;i++) {
			for(j=0;j<4;j++){
				if(dataA[i] == dataB[j] && i==j) {
					hit++;
				}
			}
		}

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

		return 0;
}

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


int a[4];
int b[4];
int hit;
int blow;

void format(){
	hit=blow=0;
}

int main(){
	
	int i;
	while((scanf("%d",&a[0]))!=EOF){
		format();
		for(i=1;i<4;i++){
			scanf("%d",&a[i]);
		}
		for(i=0;i<4;i++){
			scanf("%d",&b[i]);
			if(a[i]==b[i]){
				hit++;
			}
		}
		
		for(i=4;i--;){
			for(int j=4;j--;){
				if((a[i]==b[j])&&(a[i]!=b[i])){
					blow++;
				}
			}
		}
		
		
		printf("%d %d\n",hit,blow);
		
	}
	
	
	
	return 0;
}

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

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

}

C++: #include <iostream>
#include <array>
//ヒットの数を数え上げる
int checkNumOfHit(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < 4;i++){
        if(x.at(i) == y.at(i)) num++;
    }
    return num;
}

//ブローの数を数え上げる
int checkNumOfBlow(std :: array<int, 4> x, std :: array<int, 4> y){
    int num = 0;
    for(int i = 0;i < x.size();i++){
        for(int j = 0;j < y.size();j++){
            if((i != j) && (x.at(i) == y.at(j))) num++;
        }
    }
    return num;
}
int main(){
    std :: array<int, 4> a, b;
    while(std :: cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3)>> b.at(0) >> b.at(1) >> b.at(2) >> b.at(3)){  
        std :: cout << checkNumOfHit(a, b) << " " << checkNumOfBlow(a, b) << std :: endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void) {

	int hit = 0, blow = 0;
	int num[4],data[4];
	
	while (1) {
		for (int i = 0; i < 4; i++) {
			cin >> num[i];
		}
		for (int i = 0; i < 4; i++) {
			cin >> data[i];
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j && num[i] == data[j])
					hit++;
				else if (num[i] == data[j])
					blow++;
			}
		}
		cout << hit << " " << blow << endl;
		hit = 0, blow = 0;
	}

	return 0;
}

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

using namespace std;

int main (int argc, char const* argv[]){
    int a1,a2,a3,a4,b1,b2,b3,b4;
    int hit=0, blow=0, input;
    vector<int> A(4), B(4);
    
    while(cin >> A[0]>> A[1]>> A[2]>> A[3]){
        cin >> B[0]>> B[1]>> B[2]>> B[3];
        
        hit=0, blow=0;
        
        //count hit 
        for(int i=0;i<4;i++){
            if(A[i]==B[i]) hit++;
        }
        //count blow
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(A[i]==B[j])blow++;
            }
        }
        blow -= hit;
        A.clear();
        B.clear();
        
        cout << hit <<" " <<blow << endl;
    }
    return 0;
}

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

int main()
{
    double num, t;
	int a[4],b[4];
	int hit, brow;
	while ( cin >> a[0] >> a[1] >> a[2] >> a[3]  ) {
			cin >> b[0] >> b[1] >> b[2] >> b[3];
			
			hit = 0; brow = 0;
			for( int i = 0; i < 4; i++ ) {
				for( int j = 0; j < 4; j++ ) {
					if( b[i] == a[j] ) {
						if( i == j ) {
							hit++;
						}
						else  {
							brow++;
						}
					}
				}			
			}
			
			cout << hit << << " " << brow << endl;

	}

        return 0;
}

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

int main()
{
	for(;;)
	{
		std::vector<int> a(4);

		std::vector<int> b(4);

		for(size_t i=0; i<4; ++i)
		{
			std::cin >> a[i];
		}

		if(std::cin.eof())
		{
			break;
		}

		for(size_t i=0; i<4; ++i)
		{
			std::cin >> b[i];
		}

		int countHit=0, countBlow=0;

		
		for(size_t i=0; i<4; ++i)
		{
			if(a[i]==b[i])
			{
				++countHit;
			}
		}

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

		countBlow -= countHit;

		std::cout << countHit << ' ' << countBlow << '\n';
	}
}

C++: #include <iostream>
#include <string>
#include <cstring>

using namespace std;

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

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

int main(){

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

	do{
		hit = 0;
		blow = 0;
		for(int i=1; i<=4; i++){
			if(cin >> n == NULL) return 0;
			a[n][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;
	}while(1);
	
}

C++: // 0025 Hit and Blow
#include <iostream>
using namespace std;

int main()
{
	int a[3];
	int b[3]; 
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){ 
	  int hit  =0;
	  int blow =0;

	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; 
	}
}

C++: #include<iostream>

int main(){
	while(true){
		int hit=0,blow=0,data[2][4];
		for(int i=0;i<2;i++){
			for(int j=0;j<4;j++){
				std::cin>>data[i][j];
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(data[0][i]==data[1][j]){
					if(i==j)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=0, blow=0;

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::cin >> b[0] >> b[1] >> b[2] >> b[3];
		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;
}