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<bits/stdc++.h>
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 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 (i!=j && 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] = {0};

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

    for(int i=1; i<=9; i++){
      a[i] = 0;
    }
    for(int i=1; i<=4; i++){
      a[b[i-1]] = i;
    }

    for(int i=1; i<=4; i++){
      cin >> n;
      if(a[n] == i) hit++;
      else if(a[n] != 0) 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] ){
		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] ){
					( i==j ? hit : blow ) += 1;	
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

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

int main(){

	std::array<int, 4> num_a, num;

	std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3];

	while(std::cin >> num[0] >> num[1] >> num[2] >> num[3]){
		int hit = 0, blow = 0;
		for(std::size_t i = 0; i < 4; ++i){
			if(num_a[i] == num[i]){
				++hit;
			}else{
				for(size_t j = 0; j < 4; ++j){
					if(num_a[j] == num[i]){
						++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>
using namespace std;
int a[100], b[100], hit, blow;
int main() {
	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 (i == j && a[i] == b[j]) { hit++; }
				if (i != j && a[i] == b[j]) { blow++; }
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

C++: #include<stdio.h>

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

	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;
		brow=0;

		if(a[0]>9||a[1]>9||a[2]>9||a[3]>9||b[0]>9||b[1]>9||b[2]>9||b[3]>9)
		{
		}
		else if(a[0]<0||a[1]<0||a[2]<0||a[3]<0||b[0]<0||b[1]<0||b[2]<0||b[3]<0)
		{
		}
		else
		{
			for(int x=0;x<4;x++)
			{
				for(int y=0;y<4;y++)
				{
					if(a[x]==b[y])
					{
						if(x==y)
						{
							hit++;
						}
						else
						{
							brow++;
						}
					}
				}
			}
			printf("%d %d\n",hit,brow);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef vector<int> vi;

int hit(vi a,vi b){
  int res = 0;
  rep(i,4) if(a[i] == b[i]) res++;
  return res;
}

int blow(vi a,vi b){
  int res = 0;
  rep(i,4) rep(j,4) if(i != j && a[i] == b[j]){
    res++;
    break;
  }
  return res;
}

int main(){
  vi a(4),b(4);
  while(1){
    rep(i,4) if(!(cin>>a[i])) return 0;
    rep(i,4) cin>>b[i];
    cout<<hit(a,b)<<" "<<blow(a,b)<<endl;
  }
}

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

int main() {
  while(!cin.eof()) {
    int A[4],B[4];
    int hit = 0;
    int 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++) {
      if(A[i] == B[i])
        hit++;
    }
    for(int i=0;i<4;i++) {
      for(int j=0;j<4;j++) {
        if(A[i] == B[j]) {
          blow++;
          break;
        }
      }
    }
    blow = blow - hit;
    cout << hit << " " << blow << endl;
  }
}

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\n",hit,blow);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

        while (true) {
                for (int i = 0; i < MAX; i++) {
                        if (!(cin >> a[i])){
                                return 0;
                        }
                }
                for (int i = 0; i < MAX; i++) {
                        cin >> b[i];
                }
                int hit = 0, blow = 0;
                for (int i = 0; i < MAX; i++) {
                        if (a[i] == b[i]) {
                                hit++;
                        }
                        for (int j = 0; j < MAX; j++) {
                                if (i != j && a[i] == b[j]) {
                                        blow++;
                                }
                        }
                }
                cout << hit << " " << blow << endl;
        }

        return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int num1,num2;
    int a[5],b[5];
    while(~scanf("%d",&a[1])){
          for(int i=2;i<=4;i++){
            scanf("%d",&a[i]);
          }
          for(int i=1;i<5;i++){
            scanf("%d",&b[i]);
          }
          num1=0;
          num2=0;
          for(int i=1;i<=4;i++){
            if(a[i]==b[i]) num1++;
            for(int j=0;j<=4;j++){
                if(i!=j){
                    if(a[i]==b[j]) num2++;
                }
            }
          }
          printf("%d %d\n",num1,num2);

    }
return 0;
}

C++: #include <cstdio>

int main(){
  int a[4],b[4];
  while(~scanf("%d %d %d %d\n%d %d %d %d\n",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])){
    int c=0,d=0;
    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++)
	if(a[i]==b[j])
	  i==j?c++:d++;
    printf("%d %d\n",c,d);
  }
}