Go: package main

import "fmt"

func main() {
	var a1, a2, a3, a4, b1, b2, b3, b4 int
	for {
		i, _ := fmt.Scan(&a1, &a2, &a3, &a4)
		if i == 0 {
			break
		}
		fmt.Scan(&b1, &b2, &b3, &b4)
		a := [4]int{a1, a2, a3, a4}
		b := [4]int{b1, b2, b3, b4}
		var hit, blow int

		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if a[j] == b[k] {
					if j == k {
						hit++
					} else {
						blow++
					}
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    int s;
    while (cin >> s) {
        int a[4];
        int b[4];
        a[0] = s;
        REP(i,3) cin >> a[i+1];
        REP(i,4) cin >> b[i];
        
        int hit = 0;
        REP(i,4) {
            if (a[i] == b[i]) hit++;
        }
        
        int blow = 0;
        REP(i,4) {
            if (find(begin(a), end(a), b[i]) != end(a)) {
                if (b[i] != a[i]) blow++;
            }
        }
        
        cout << hit << " " << blow << endl;
    }
    return 0;
}

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

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

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

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

    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b, c, d, e, f, g, h;
	int hit, blow;
	while (cin >> a >> b >> c >> d >> e >> f >> g >> h) {
		hit = 0;
		blow = 0;
		if      (a == e){
			//cout << "11" << endl;
			hit += 1;
		}
		else if (a == f){
			//cout << "12" << endl;
			blow += 1;
		}
		else if (a == g) {
			//cout << "13" << endl;
			blow += 1;
		}
		else if (a == h) {
			//cout << "14" << endl;
			blow += 1;
		}
		if (b == e) {
			//cout << "21" << endl;
			blow += 1;
		}
		else if (b == f) {
			//cout << "22" << endl;
			hit += 1;
		}
		else if (b == g) {
			//cout << "23" << endl;
			blow += 1;
		}
		else if (b == h) {
			//cout << "24" << endl;
			blow += 1;
		}
		if (c == e) {
			//cout << "31" << endl;
			blow += 1;
		}
		else if (c == f) {
			//cout << "32" << endl;
			blow += 1;
		}
		else if (c == g) {
		//	cout << "33" << endl;
			hit += 1;
		}
		else if (c == h) {
	//		cout << "34" << endl;
			blow += 1;
		}
		if (d == e) {
	//		cout << "41" << endl;
			blow += 1;
		}
		else if (d == f) {
	//		cout << "42" << endl;
			blow += 1;
		}
		else if (d == g) {
	//		cout << "43" << endl;
			blow += 1;
		}
		else if (d == h) {
	//		cout << "44" << endl;
			hit += 1;
		}
		cout << hit <<" "<< blow << endl;
	}
}

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

using namespace std;

int main(){
	int a[4], b[4];
	while (scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF){
		int hit = 0;
		int 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++;
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: //0025 Hit and Blow
//4ツ古つづ個青板篠堋づ粂IT(ツ湘ェツ渉環、ツ値ツつェツ暗ェツ致ツ）ツ、Blow(ツ湘ェツ渉環づ債暗。ツつ、ツつェツ値ツづ債暗ェツ致ツ）ツづ個古つ青板づーツ板サツ津ィツつケツづヲ

#include<iostream>
#include<algorithm>
using namespace std;

int main(void)
{
	const int N = 4;
	int a[N], b[N];
	int i;

	while(1)
	{
		for(i = 0; i < N; i++)
			cin >> a[i];
		for(i = 0; i < N; i++)
			cin >> b[i];
		if(!cin)
			break;

		int hit = 0,
			blow = 0;
		for(i = 0; i < N; i++)
		{
			if(a[i] == b[i])
				hit++;
			else if(find(a, a+N, b[i]) != a+N)
				blow++;
		}

		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
 
int main(){
    std::vector<int> a(4);
     
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        int hit = 0, blow = 0;
         
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
             
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
				++hit;
			}
            else if(it != a.end()){
				++blow;
			}
        }
        std::cout << hit << " " << blow << std::endl;
    }
    
    return 0;
}

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

int hit(int a[], int b[]) {
    int cnt = 0;
    for(int r = 0; r < 4; r++) {
        if(a[r] == b[r]) cnt++;
    }
    return(cnt);
}

//少し未完成なblow
int blow(int a[], int b[]) {
    int cnt = 0;
    for(int r = 0; r < 4; r++) {
        for(int c = 0; c < 4; c++) {
            if(a[r] == b[c]) cnt++;
        }
    }
    return(cnt);
}

int main(void) {
    int a[4], b[4];
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
        int hi = hit(a, b);
        int bl = blow(a, b) - hi;
        cout << hi << " " << bl << endl;
    }
    return(0);
}

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

int main(){
    std::array<int, 4> a; //player A
    std::array<int, 4> b; //player B
    int hit=0;
    int blow=0;
   
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        std::cin >> b[0] >> b[1] >> b[2] >> b[3];      
        //if(a[0] == a[1] == a[2] == a[3] == b[0] == b[1] == b[2] == b[3] == -1)
	//break;

	//    std::cout << b[0];
    
    for(int i=0; i<a.size(); ++i){
        for(int j=0; j<b.size(); ++j){
	    if(a[i] == b[j] && i == j)
	        ++hit;
	    else if(a[i] == b[j] && i != j)
	        ++blow;
	}
    }

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

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a[5],b[5];
	int ssr,sr;
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		ssr=0;
		sr=0;
		fu(0,4){
			if(a[i]==b[i]){
				ssr++;
				a[i]=INF;
				b[i]=INF;
			}
		}
		fu(0,4){
			if(b[i]!=INF){
				for(int r=0;r<4;r++){
					if(b[i]==a[r]) sr++;
				}
			}
		}
		cout<<ssr<<" "<<sr<<endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int a[4], b[4];
	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)
	{
		set<int> included;
		for (int i = 0; i < 4; ++i)
			included.insert(a[i]);
		
		int hit, blow;
		hit = blow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i])
				++hit;
			else if (included.count(b[i]) > 0)
				++blow;
		}
		printf("%d %d\n", hit, blow);
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

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