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 <set>
#include <array>
#include <iostream>

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
  	blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size()) << std::endl;
    blowing.clear();
  }
return 0;
}

C++: #include<stdio.h>

int main(){
    /*    int m[10];
    int i,j,k;

    for(i = 0; i < 10; i++){
        scanf("%d",&m[i]);
    }

    for(j = 0; j < 9; j++){
        for(k = 0; k < 9-j; k++){
            if(m[k] < m[k+1]){
                int num = m[k+1];
                m[k+1] = m[k];
                m[k] = num;
            }
        }
    }

    for(i = 0; i < 3; i++){
        printf("%d\n",m[i]);
    }
    */

    while(1){

        int x[4],y[4];
        int i,j;
        int hit = 0,blow = 0;
        int res = scanf("%d%d%d%d",&x[0],&x[1],&x[2],&x[3]);
        if(res==EOF) break;

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

        for(i = 0; i < 4; i++){
            if(x[i] == y[i]){
                hit++;
            }
        }
        for(i = 0; i < 4; i++){
            for(j = 0; j < 4; j++){
                if(x[i] == y[j] && i != j){
                    blow++;
                }
            }
        }

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int a[4], b[4];
	int hit = 0, brow = 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) hit++;
				else brow++;
			}
		}
	}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a[10],b[10];
  int hit=0,blow=0;
  while(scanf("%d",&a[0])!=EOF){
    for(int i=1;i<4;i++){
      cin >> a[i];
    }
    for(int i=0;i<4;i++){
      cin >> b[i];
    }
    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>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   int a[4],b[4];
   int hit,blow;
   while(cin>>a[0])
   {
     hit=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 i=0;i<4;i++)
     {
       for(int j=0;j<4;j++)
       {
         if(j==i) j++;
         if(a[i]==b[j]) blow++;        
       }        
     }
     cout<<hit<<" "<<blow<<endl;
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <functional>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
//#define scanf scanf_s

int a[4]; int b[4];

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
  int a[4],b[4];
  int hit,blow;
  while(cin >> a[0]){
    for(int i=1;i<4;i++)cin >> a[i];
    for(int i=0;i<4;i++)cin >> b[i];
    hit = blow = 0;
    for(int i=0;i<4;i++){
      if(a[i] == b[i])hit++;
      for(int j=0;j<4;j++){
	if(i != j && a[i] == b[j])blow++;
      }
    }
    cout << hit << ' ' << blow << endl;
  }
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	vector<int> a(4);
	vector<int> b(4);

	string sa;
	for (; getline(cin, sa);)
	{
		stringstream ssa;
		ssa << sa;

		for (int i = 0; i < 4; i++)
		{
			ssa >> a.at(i);
		}

		string sb;
		getline(cin, sb);
		stringstream ssb;
		ssb << sb;

		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++)
		{
			ssb >> b.at(i);
			if (a.at(i) == b.at(i))
			{
				hit++;
			}
		}

		sort(a.begin(), a.end());
		sort(b.begin(), b.end());

		for (int i = 0; i < 4; i++)
		{
			if (a.at(i) == b.at(i))
			{
				blow++;
			}
		}

		blow -= hit;
		if (blow < 0)
		{
			blow = 0;
		}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a[4],b[4],b1=0,b2=0,hit=0,boro=0;
    while(scanf("%d",&a[0])!=EOF){
        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++){
            for(int j=0;j<4;j++){
                if(i==j&&a[i]==b[j]){
                    b1=0;b2=1;
                    break;
                }
                if(a[i]==b[j])b1=1;
            }
            hit+=b2;boro+=b1;
            b1=0;b2=0;
        }
        cout<<hit<<" "<<boro<<endl;
        hit=0;boro=0;
    }
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  vector<int> hit_anss;
  vector<int> bolor_anss;
  int nums_a[4],nums_b[4];
  while(cin>>nums_a[0]>>nums_a[1]>>nums_a[2]>>nums_a[3]){
    int hit=0,bolor=0;
    for(int i=0;i<4;i++){
      cin>>nums_b[i];
    }
    //hit????¢????
    for(int i=0;i<4;i++){
      if(nums_a[i]==nums_b[i])hit++;
    }
    //bolor????¢????
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j)continue;
        if(nums_a[i]==nums_b[j]){
          bolor++;
          break;
        }
      }
    }
    hit_anss.push_back(hit);
    bolor_anss.push_back(bolor);
  }
  for(int i=0;i<hit_anss.size();i++){
    cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl;
  }
}