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>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    int tmp = 0;
    while(1){
        if(tmp > 50) break;
        vector<int> a(4);
        vector<int> b(4);
        rep(i,4) cin >> a[i];
        rep(i,4) cin >> b[i];
        int hit = 0,blow = 0;
        rep(i,4){
            if(a[i] == b[i]) hit++;
            else {
                rep(j,4) if(a[j] == b[i]) blow++;
            }
        }
        cout << hit << " " << blow << endl;
        tmp++;
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	int a[4], b[4], A[10] = {0}, B[10] = {0}, h = 0, br = 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)
		{
			A[a[i]]++;
			B[b[i]]++;
		}
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]){
				h++;
				A[a[i]]--;
				B[b[i]]--;
			}
			cout << a[i]  << b[i] << endl;
		}
		for (int i = 0; i < 10; ++i)
		{
			if(A[i] == 1 && B[i] == 1){
				br++;
			}
		}
		cout << h << ' ' << br << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
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 A[10] = {0}, B[10] = {0}, h = 0, br = 0;
		for (int i = 0; i < 4; ++i)
		{
			A[a[i]]++;
			B[b[i]]++;
		}
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]){
				h++;
				A[a[i]]--;
				B[b[i]]--;
			}
			//cout << a[i]  << b[i] << endl;
		}
		for (int i = 0; i < 10; ++i)
		{
			if(A[i] == 1 && B[i] == 1){
				br++;
			}
		}
		cout << h << ' ' << br << endl;
	}
}

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

int main() {
  vector<int> a(4), b(4);
  while (cin >> a[0]) {
    for (int i = 1; i < 4; i++) cin >> a[i];
    for (int i = 0; i < 4; i++) cin >> b[i];
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      if (find(b.begin(), b.end(), a[i]) != b.end()) {
        if (a[i] == b[i]) hit++;
        else blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
}

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

int main(){
	int Hit , Blow ;
	char a[4],b[4];
	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(a[i] == a[j]) Blow++;
			}
		}

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

		cout << Hit << " " << Blow << "\n";
	}

}

C++: #include<iostream>
using namespace std;
main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int hit=0,blow=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])++hit;
			for(int j=0;j<4;++j){
				if(a[i]==b[j] && i!=j)++blow;
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
    
int main(){
    std::vector<int> a(4);
        
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
            
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
                
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
                ++hit;
            }else if(it != a.end()){
                ++blow;
            }
        }
        std::cout << hit << " " << blow << std::endl;
    }
       
    return 0;
}

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

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

C++: 
#include <iostream>
using namespace std;
int main(){
    int a[4],b[4],hcount=0,bcount=0;
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
    hcount=0;
    bcount=0;
    for(int k=0;k<4;k++){
        for(int s=0;s<4;s++){
            if(a[k]==b[s]&&k==s)hcount++;
            else if(a[k]==b[s]&&k!=s)bcount++;
        }
    }
    cout<<hcount<<" "<<bcount<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;

double xx(double r) {
	return r*r;
}

ll gcd(ll a, ll b) {
	if (a == 0) return b;
	return gcd(b%a, a);
}

int main() {
	int a[4], b[4];
	while ( scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3]) != EOF ) {
		for (int i = 0; i < 4; ++i) scanf("%d", &b[i]);

		map<int, bool> m;
		for (int i = 0; i < 4; ++i) m[a[i]] = true;

		int hit = 0, blow = 0;
		for (int i = 0; i < 4; ++i) {
			if (a[i] == b[i]) ++hit;
			else if (m[b[i]]) ++blow;
		}
		cout << hit << " " << blow << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

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