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 <cmath>
using namespace std;

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

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

int main()
{
 int a[4];

 while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
  int c = 0;
  int hit = 0, blow = 0;
  for(int i=0; i<4; i++){
   int n;
   cin >> n;
   if(n == a[c]){
    hit++;
    continue;
   }
   for(int j=0; j<4; j++){
    if(n == a[c]){
     blow++;
     break;
    }
   }
  }
  cout << hit << ' ' << blow << '\n';
 }
 
 return 0;
}

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

int main(){
	std::array<u_int, 4> que;
	std::array<u_int, 4> ans;

	while(std::cin >> que[0] >> que[1] >> que[2] >> que[3] && std::cin >> ans[0] >> ans[1] >> ans[2] >> ans[3]){
		
		int hit = 0;
		int blow = 0;
		
		for(int i = 0; i < 4; ++i){
			if(que[i] == ans[i])
				hit++;

			if(que[i] == ans[(i + 1) % 4] || que[i] == ans[(i + 2) % 4] || que[i] == ans[(i + 3) % 4])
				blow++;
		}

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

	return 0;
}

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

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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++) {
      if(a[i] == b[i]) {
	hit++;
	continue;
      }
      for(int j = 0; j < 4; j++) {
	if(a[i] == b[j])blow++;
      }
    }
    cout << hit << ' ' << blow << endl;
  }
}

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

int main(void){
  int a[4];
  int b[4];

  while( cin >> a[0] >> a[1] >> a[2] >> a[3] ){
    cin >> b[0] >> b[1] >> b[2] >> b[3];

    int count=0;
    int hit=0;
    int blow=0;

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

C++: #include<iostream>

using namespace std;

int main() {
	
	int A[4] = {};
	int B[4] = {};
	
	while(cin >> A[0]) {
	int hit = 0;
	int 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++) {
		
		for(int j=0;j<4;j++) {
			
			if(A[i] == B[j]) {
				
				if( i == j )
					hit++;
					
				else
					blow++;
					
		}
		
	}
	
}
	cout << hit << " " << blow << "\n";
}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int size = 4;
	int ina[size];
	int inb[size];
	int hit=0, blow=0;
	while(true){
		cin>>ina[0]>>ina[1]>>ina[2]>>ina[3];
		cin>>inb[0]>>inb[1]>>inb[2]>>inb[3];
		if(cin.eof()) break;
		for(int i=0; i<size; i++) {
			if(ina[i] == inb[i]) hit++;
			for(int j=0; j<size; j++){
				if(i==j) break;
				if(ina[i] == inb[j]) blow++;
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int a[4], b[4];
  while(cin >> a[0]){
    rep(i, 3)cin >> a[i+1];
    rep(i, 4)cin >> b[i];
    int hit = 0;
    int blow = 0;
    rep(i, 4){
      if(a[i] == b[i])hit++;
      rep(j, 4){
        if(a[i] == b[j]){
          blow++;
          break;
        }
      }
    }
    cout << hit << " " << blow - hit << endl;
  }
	return 0;
}