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>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

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

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

int main(){
  int hit,blow,w,x,y,z;
  vi a(4,0),b(4,0) ;
  while(cin >> w >> x >> y >> z){
    hit = 0,blow = 0;
    a[0] = w,a[1] = x,a[2] = y,a[3] = z ;
    for(int i =0; i < 4; ++i){
      cin >> x ;
      b[i] = x ;
    }
    rep(i,4){
      rep(j,4){
        if(a[i] == b[j] && i == j){
          ++hit ;
        }
        else if(a[i] == b[j]){
          ++blow ;
        }
      }
    }
    cout << hit << " " << blow << endl ;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a[4],b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		int hit = 0 , bro = 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	bro++;
				}
			}
		}
		cout << hit << ' ' << bro << endl; 
	}
}

C++: #include<iostream>
using namespace std;
 
int main(void){
  int a[4];
  int b[4];
  int hit=0;
  int blow=0;
 
  while(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++){
    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 <stdio.h>

int main(void) {
  int n, i, j, k, a[4], b[4];
  while(scanf("%d", &a[0]) != EOF) {
    for(i = 1; i < 4; ++i) scanf("%d", &a[i]);
    for(i = 0; i < 4; ++i) scanf("%d", &b[i]);
    int h = 0, bl = 0, flag[10];
    for(i = 0; i < 10; ++i) flag[i] = 0;
    for(i = 0; i < 4; ++i) {
      if(a[i] == b[i]) h++;
      else flag[a[i]] = 1;
    }
    for(i = 0; i < 4; ++i) if(flag[b[i]]) ++bl;
    printf("%d %d\n", h, bl);
  }
  return 0;
}

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

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

int main()
{
	int a[5],b[5];
	
	while(1){
		int hit=0,blow=0;
		
		scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		
		for(int i=0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				continue;
			}
			blow = count(a,a+4,b[i]);
		}
		printf("%d %d\n", hit, blow);
	}
	
	return (0);
}

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

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

	while (1){
		cin >> a[0] >> 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++){
			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++;
			}
		}
		blow -= hit;

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

C++: #include<iostream>

using namespace std;


int main(){
	
	int A[4] = {};
	int B[4] = {};
	
	int yes = 0;
	int no = 0;
	
	for(int i=0;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)
		yes++;
		
		else
		no++;
	}
	cout << yes << " " << no << "\n"; 
    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, 4> A = {a1, a2, a3, a4};
		std::array<int, 4> B = {b1, b2, b3, b4};
		
		int hit = 0;
		int blow = 0;

		for(int i = 0; i < 4; ++i){
			
			if(A[i] == B[i])
				++hit;
			
	                else
			blow += std::count(A.begin(), A.end(), B[i]);

		}

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

		return 0;

}

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

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

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

int main(){

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

	

	while(true){
		std::cin >> num_a[0] >> num_a[1] >> num_a[2] >> num_a[3];
		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<iostream>
using namespace std;
int main(){
  int a[4],b[4];
  while(cin >>a[0]){
    int hans = 0, bans = 0;
    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++){
      if(a[i] == b[i]){
	hans++;
	a[i] = 10;
	b[i] = 11;
      }
    }
    for(int i=0; i<4; i++){
      for(int j=0; j<4; j++){
	if(a[i] == b[j]){
	  bans++;
	  a[i] = 10;
	  b[j] = 11;
	}
      }
    }
    cout <<hans<<" "<<bans<<endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

int main(){
	vector<int> a(4);
	vector<int> b(4);
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		int hit=0;
		int bro=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{
						bro++;
					}
				}
			}
		}
		cout<<hit<<" "<<bro<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    int a[4],b[4];
    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]);
        int h=0,l=0;
        for (int i=0;i<4;i++) {
            for (int j=0;j<4;j++) {
                if (i!=j && a[i]==b[j]) {
                    l+=1;
                } else if (a[i]==b[j]) {
                    h+=1;
                }
            }
        }
        printf("%d %d\n",h,l);
    }
    return 0;
}