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 <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	while (1)
	{
		vector<int> a(4, 0), b(4, 0);
		int hit = 0, blow = 0;
		rep(i, 4) { cin >> a[i]; }
		rep(i, 4) { cin >> b[i]; }
		rep(i, 4)
		{
			if (a[i] == b[i]) { hit += 1; }
		}
		rep(i, 4)
		{
			blow += count(all(b), a[i]);
		}
		printf("%d %d\n", hit, blow - hit);
	}
	return 0;
}

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

int main()
{
 int a[4];
 int b[4];
 while(cin>>a[0]>>a[1]>>a[2]>>a[3])
 {
   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,b,c,d,e,f,g,h,x,y;
    
    while (cin >> a >> b >> c >> d) {
    x = 0;
    y = 0;
    cin >> e >> f >> g >> h;
        if (a==e){x=x+1 ;e=e+10;} 
        if (b==f){x=x+1;f=f+10;} 
        if (c==g){x=x+1;g=g+10;}
        if (d==h){x=x+1;h=h+10;}
        if (e==a || e==b || e==c || e==d){y=y+1;}
        if (f==a || f==b || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==c || g==d){y=y+1;}
        if (h==a || h==b || h==c || h==d){y=y+1;}
        cout << x << " " <<  y << 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]){
		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[i]){
					hit++;
					break;
				}else if(a[i] == b[j] && i!=j){
					blow++;
					break;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int size = 4;
	int ina[size];
	int inb[size];
	while(true){
		int hit=0, blow=0;
		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) continue;
				if(ina[i] == inb[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]){
		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 <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie acos(-1)
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int a,b,c,d,e,f,g,h;
signed main(){
    while(cin>>a>>b>>c>>d>>e>>f>>g>>h){
        int x=0;
        if(a==e)x++;
        if(b==f)x++;
        if(c==g)x++;
        if(d==h)x++;
        cout<<x<<" ";
        int y=0;
        if(a==f||a==g||a==h)y++;
        if(b==e||b==g||b==h)y++;
        if(c==e||c==f||c==h)y++;
        if(d==e||d==f||d==g)y++;
        cout<<y<<endl;
    }
}

C++: #include <iostream>

int main()
{
	int v[2][4];
	while( std::cin>>v[0][0]>>v[0][1]>>v[0][2]>>v[0][3]>>v[1][0]>>v[1][1]>>v[1][2]>>v[1][3] )
	{
		int hit = 0, blow = 0;

		for( int i=0; i<4; ++i )
		{
			if( v[0][i] == v[1][i] )
			{
				++hit;
				continue;
			}

			for( int j=0; j<4; ++j )
			{
				blow += v[0][i] == v[1][j];
			}
		}

		std::cout << hit << ' ' << blow << '\n';
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    std::deque<int> deqa;
    std::deque<int> deqb;
    int a,b,hit,blow;
    hit = 0;
    blow = 0;
    while (cin >> a) {
        int tmp = a;
        deqa.emplace_back(tmp);
        for (int i=0;i<3;i++) {
            cin >> a;
            deqa.emplace_back(a);
        }
        for (int j=0;j<4;j++) {
            cin >> b;
            deqb.emplace_back(b);
        }
        int a1 = deqa[0];
        int b1 = deqb[0];
        int a2 = deqa[1];
        int b2 = deqb[1];
        int a3 = deqa[2];
        int b3 = deqb[2];
        int a4 = deqa[3];
        int b4 = deqb[3];
        if (a1==b1) {
            hit++;
        } else if (b1==a2 || b1==a3 || b1==a4) {
            blow++;
        }
        if (a2==b2) {
            hit++;
        } else if (b2==a1 || b2==a3 || b2==a4) {
            blow++;
        }
        if (a3==b3) {
            hit++;
        } else if (b3==a1 || b3==a2 || b3==a4) {
            blow++;
        }
        if (a4==b4) {
            hit++;
        } else if (b4==a1 || b4==a2 || b4==a3) {
            blow++;
        }
        cout << hit << " " << blow << endl;
        
        deqa.clear();
        deqb.clear();
        hit = 0;
        blow = 0;
    }
}

C++: #include<iostream>

using namespace std;

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

	while (1){
		for (int i = 0; i < 4; i++)
			cin >> a[i];
		for (int i = 0; i < 4; i++)
			cin >> b[i];

		//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>
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 = 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[j] == b[i])
	    blow++;
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

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

int main(){
  std::array<int, 4> a = {};
  std::array<int, 4> b = {};
  int hit = 0;
  int blow = 0;
  int N = 0;

  while(N <= 50 && std::cin >> a[0] >> a[1] >> a[2] >> a[3] && std::cin >> b[0] >> b[1] >> b[2] >> b[3]){
    for(int i = 0;i < 4;++i){
      for(int j = 0;j < 4;++j){
          if(a[i] == b[j] && i == j)
              ++hit;
          if(a[i] == b[j] && i != j)
              ++blow;
            }
        }
    std::cout << hit << " " << blow << std::endl;

    hit = 0;
    blow = 0;
    ++N;
  }
}