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>
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 (i == j && a[i] == b[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] >> b[0] >> b[1] >> b[2] >> b[3]){
		//hit
		int hit = 0;
		for (int i = 0; i < 4; i++)
			hit += (a[i] == b[i]);


		//blow
		int blow = 0;
		for (int i = 0; i < 4; i++)
			blow += ((a[i] == b[0]) || (a[i] == b[1]) || (a[i] == b[2]) || (a[i] == b[3]));

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

	return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int a[4];
	int b[4];
	while(cin >> a[0]){
		int hit = 0;
		int brow = 0;
		FOR(i,1,4){
			cin >> a[i];
		}
		rep(i,4){
			cin >> b[i];
			if(a[i] == b[i])hit++;
		}
		rep(i,4)rep(j,4){
			if(a[i] == b[j] && a[i] != -1 && b[i] != -1){
				brow++;
				a[i] = -1; b[j] = -1;
			}
		}
		cout << hit << " " << (brow-hit) << endl;
	}

	return 0;
}

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

int main()
{
	while(true){
		int a[4],b[4];
		int hit = 0,blow = 0;
		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=i;j<4;++j){
				if(a[i] == b[j])
					++blow;
			}
		}

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

		blow -= hit;	
		cout << hit << " " << blow << endl;

	}
	return 0;
}

C++: #include<iostream>

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

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

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

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]>> b[0] >> b[1] >> b[2] >> b[3]){
		
		h=0;
		br=0;
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		
		cout << h << ' '<< br << endl;
	}
}

C++: #include <iostream>
using namespace std;
 
int main() {
 
  int a[4],b[4];
 
  while(true) {
 
  
 
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3];
 
  if ( cin.eof() ) break;

    int hit = 0;
    int blow = 0;
 
    for ( int i = 0; i < 4; i++ ) {
 
      for ( int j = 0; j < 4; j++ ) {
 
    int k = ( i + j ) % 4;
 
    if ( a[i] == b[k] ) {
 
      if ( i == k ) {
        hit++;
      }else {
        blow++;
      }
      break;
 
    }
 
      }
 
    }
 
    cout << hit << " " << blow << endl;
 
  }
 
  return 0;
 
}

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] >> b[0] >> b[1] >> b[2] >> b[3]) {

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

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

int main(){
	std::array<u_int, 4> a,b;
	int hit,blow;

	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
		std::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 j=0;j<4;j++){
				if(a[i]==b[j]) blow++;
			}
		}
		std::cout << hit << blow-hit << std::endl;
	}

    return 0;
}

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

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

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

int main()
{

    int a[4], b[4];
    set<int> c;
    while(scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3)!=EOF)
    {
        c.clear();
        for(int i=0; i<4; i++)
        {
            c.insert(a[i]);
        }
        int d=0,e=0;
        for(int i=0; i<4; i++)
        {
            if(b[i]==a[i])
            {
                d++;
                e++;
            }
            else if(c.find(b[i])!=c.end())
                e++;
        }
        printf("%d %d\n",d,e-d);
    }
    return 0;
}