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<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int a[4],b[4];
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
	int hit=0,blow=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(i==j)continue;
		if(a[i]==b[j])blow++;
		}
	}
	for(int i=0;i<4;i++)if(a[i]==b[i])hit++;
	cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int a[4],b[4];
	for(;cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3];){
		int x=0,y=0;
		rep(i,4)if(a[i]==b[i])x++;
		rep(i,4)rep(j,4)if(i!=j&&a[i]==b[j])y++;
		printf("%d %d\n",x,y);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int a[4];
	int b[4];
	while(1){
		if(cin.eof())
			break;

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

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

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

C++: #include <iostream>

int main() {
	int a[4], b[4], hit, blow;
	while (std::cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		hit = 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;
					} else {
						++blow;
					}
				}
			}
		}
		std::cout << hit << ' ' << blow << '\n';
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
using namespace std;
int main ()
{
	while (1)
	{
		int a[4], b[4];
		int H = 0, B = 0;
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &a[i]) == EOF)return 0;
		}
		for (int i = 0; i < 4; i++)
		{
			if (scanf("%d", &b[i]) == EOF)return 0;
			if (b[i] == a[i])H++;
			for (int l = 0; l < 4; l++)
			{
				if (l == i)continue;
				if (a[l] == b[i])B++;
			}
		}
		cout << H << " " << B << endl;

	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int a[4], b[4], hit = 0, blow = 0;
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3])
    {
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        
        rep(i,4)
        {
            rep(j,4)
            {
                if(a[i] == b[j])
                {
                    if(a[i] == b[i])
                    {
                        hit++;
                        break;
                    }
                    else
                    {
                        blow++;
                        break;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }

    return 0;
}

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

int main(){
	int A[4], B[4];
	while( 1 ){
		int hit = 0, blow = 0;
		bool check[10] = {false};
		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++) check[A[i]] = true;
		for( int i=0; i<4; i++ ) if( A[i] != B[i] && check[B[i]] ) blow++;
		cout << hit << " " << blow << endl;
	}
}

C++: #include <cstdio>

#define rep(i, n) for(int i = 0; i < n; i ++)

using namespace std;

int main(void){
    int a[4], b[4];
    while(~scanf("%d %d %d %d", a, a + 1, a + 2, a + 3)){
        scanf("%d %d %d %d", b, b + 1, b + 2, b + 3);
        int hit = 0, blow = 0;

        rep(i, 4) rep(j, 4) if(a[i] == b[j]) if(i == j) hit ++; else blow ++;

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

    return 0;
}

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

int main() {
	int a[4], b[4];
	while(cin >> a[0]) {
		bool v[10];
		memset(v, 0, sizeof v);
		v[a[0]] = 1;
		for(int i = 1; i < 4; i ++) {
			cin >> a[i];
			v[a[i]] = 1;
		}
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i ++) {
			cin >> b[i];
			if(a[i] == b[i])
				hit ++;
			if(v[b[i]])
				blow ++;
		}
		blow -= hit;
		cout << hit << ' ' << blow << '\n';
	}
	return 0;
}