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<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    string a0,a1,a2,a3,b0,b1,b2,b3;
    while(cin>>a0>>a1>>a2>>a3>>b0>>b1>>b2>>b3){
        int h=0,bl=0;
        if(a0==b0)h++;
        if(a1==b1)h++;
        if(a2==b2)h++;
        if(a3==b3)h++;
        if(a0==b1||a0==b2||a0==b3) bl++;
        if(a1==b0||a1==b2||a1==b3) bl++;
        if(a2==b0||a2==b1||a2==b3) bl++;
        if(a3==b0||a3==b1||a3==b2) bl++;
        
        cout<<h<<" "<<bl<<endl;
    }
    return 0;
}

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

int main(void){
  int a[4],b[4];
  int hit;
  int blow;
  cin >> a[0] >> a[1] >> a[2] >> a[3];
  cin >> b[0] >> b[1] >> b[2] >> b[3];
  while(!cin.eof()){
    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(i!=j and a[i] == b[j]){
	  blow++;
	}
      }
    }
    cout << hit << " " << blow << endl;
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    cin >> b[0] >> b[1] >> b[2] >> b[3];
  }
  return 0;
}

C++: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication26
{
    class Program
    {
        static void Main(string[] args)
        {
			string s,t;
			while((s=Console.ReadLine())!=null)
			{
				t=Console.ReadLine();
				int[] a = s.Split().Select(int.Parse).ToArray();
				int[] b = t.Split().Select(int.Parse).ToArray();
				int d,e;
				d=e=0;
				for(int c =0;c<4;c++)
				{
					if(a[c]==b[c])d++;
					else{
						bool flag=false;
						for(int h =0;h<4;h++)
						{
							if(a[c]==b[h])flag=true;
						}
						if(flag==true)e++;
					}
				}
				Console.WriteLine("{0} {1}",d,e);
			}
		}
    }
}

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

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int a[4],b[4];
    while (true)
    {
        if ( cin.eof() ) { break; }
        rep(j,4) cin>>a[j];
        rep(j,4) cin>>b[j];
        
        int hit=0,bl=0;
        rep(i,4){
            rep(j,4){
                if(a[i]==b[j]){
                    if(i==j) hit++;
                    else bl++;
                }
                
            }
        }
        cout<<hit<<" "<<bl<<endl;
    }
    return 0;
}

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

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

int main() {
	vci a(4), b(4);
	bool use[10] = { 0 };
	
	while (cin >> a[0]) {
		for_(i, 1, 4) cin >> a[i];
		for_(i, 0, 4) cin >> b[i];
		
		for_(i, 0, 4) use[ a[i] ] = 1;
		
		int hit = 0, blow = 0;
		for_(i, 0, 4) {
			if (a[i] == b[i] ) hit++;
			else if (use[ b[i] ]) blow++;
		}
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)

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

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

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

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