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 <algorithm>
#include <cstdio>
using namespace std;

int hit(int str[],int str2[]){
  int i, j = 0;

  for(i = 0;i < 4;i++){
    if(str[i] == str2[i]){
      j++;
    }
  }

  return j;
}

int blow(int str3[],int str4[]){
  int i, j = 0;

  sort(str3, str3 + 4);
  sort(str4, str4 + 4);

  for(i = 0;i < 4;i++){
    if(str3[i] == str4[i]){
      j++;
    }
  }

  return j;
}

int main(){
  int str[4], str2[4];

  while(scanf("%d %d %d %d", &str[0], &str[1], &str[2], &str[3]) != EOF){ 

    cin >> str2[0] >> str2[1] >> str2[2] >> str2[3];

  int hit_var = hit(str, str2);
  int blow_var = blow(str, str2);

  cout << hit_var << " " << blow_var - hit_var << endl;

  }

  return 0;
}

C++: #include <iostream>

#define SIZE 4

using namespace std;

int main() {
	int a[SIZE], b[SIZE], hit, blo;

	while (cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]) {
		hit = 0;
		blo = 0;
		for (int i = 0; i < SIZE; i++) {
			if (a[i] == b[i]) {
				hit++;
				a[i] = -1;
				b[i] = -1;
			}
		}

		for (int i = 0; i < SIZE; i++) {
			for (int j = 0; j < SIZE; j++) {
				if (a[i] == -1 || b[j] == -1) {
					continue;
				}

				if (a[i] == b[j]) {
					a[i] = -1;
					b[j] = -1;
					blo++;
				}
			}
		}
		cout << hit << " " << blo << endl;
	}

	return 0;
}

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)) blow++;
        }
        
        cout << hit << " " << blow - hit;
    }
    return 0;
}

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

int main(){
	
	std::array<int, 4> A;
	while(std::cin >> A[0] >> A[1] >> A[2] >> A[3]){
		std::array<int, 4> B;
		std::cin >> B[0] >> B[1] >> B[2] >> B[3];
		
		int hit = 0;
		int blow = 0;
		for(int i=0; i<4; ++i){
			if( A[i] == B[i] )
				++hit;
			for(int j=i+1; j<4; ++j)
				if( A[i] == B[j] )
					++blow;
		}
		std::cout << hit << " " << blow << std::endl;
	}
	return 0;
}

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

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

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

int a[4], b[4];

int main() {
	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, blow = 0;
		for( i = 0; i < 4; i++ )
			hit += (a[i] == b[i]);
		
		for( i = 0; i < 4; i++ ) {
			for( j = 0; j < 4; j++ ) {
				if ( a[i] == b[j] ) {
					break;
				}
			}
			blow += (j < 4);
		}
		blow -= hit;
		
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int size = 4;
	int ina[size];
	int inb[size];
	int hit=0, blow=0;
	while(true){
		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 <bits/stdc++.h>

using namespace std;

int main()
{
    int a[4], b[4];
    
    while (~scanf("%d%d%d%d\n%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&b[0],&b[1],&b[2],&b[3])){
        bool c[10] = {};
        for (int i = 0; i < 4; ++i) c[a[i]] = true;
        int hit = 0, blow = 0;
        for (int i = 0; i < 4; ++i) {
            if (a[i] == b[i]) hit++;
            else if (c[b[i]]) blow++;
        }
        printf("%d %d\n", hit, blow);
    }
}

C++: #include<vector>
#include<iostream>
using namespace std;
int main() {
	int code[4], line, hit, bro;
	while (true) {
		hit = 0;
		bro = 0;
		for (int i = 0; i < 4; ++i) {
			cin >> code[i];
		}#include<vector>
#include<iostream>
using namespace std;
int main() {
	int code[4], line, hit, bro;
	while (cin>>code[0]) {
		hit = 0;
		bro = 0;
		for (int i = 1; i < 4; ++i) {
			cin >> code[i];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> line;
			if (code[i] == line) {
				++hit;
			}
			else {
				for (int i2 = 0; i2 < 4; ++i2) {
					if (code[i2] == line) {
						++bro;
					}
				}
			}
		}
		cout << hit << " " << bro << endl;
	}
	return 0;
}
		for (int i = 0; i < 4; ++i) {
			cin >> line;
			if (code[i] == line) {
				++hit;
			}
			else {
				for (int i2 = 0; i2 < 4; ++i2) {
					if (code[i2] == line) {
						++bro;
					}
				}
			}
		}
		cout << hit << " " << bro << endl;
	}
	return 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];

		if (cin.eof()) break;

		int hit = 0, blow = 0;
		for (int i=0; i<4; ++i) {
			for (int j=i; j<4; ++j) {
				if (a[i] == b[j] && i == j) {
					hit ++;
				} else if (a[i] == b[j]) {
					blow ++;
				}
			}
		}

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

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
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++) {
			if (a[i] == b[i])hit++;
			for (int j = 0; j < 4; j++) {
				if (i == j)continue;
				if (a[i] == b[j])blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

int main (){

    //data_set : a and b
    std::array<int, 4> data_a;
    std::array<int, 4> data_b;

    while(std::cin >> data_a[0] >> data_a[1] >> data_a[2] >> data_a[3]){
        std::cin >> data_b[0] >> data_b[1] >> data_b[2] >> data_b[3];
        int hit = 0;
        int blow = 0;
        for(int i = 0; i < 4; ++i){
            //if same digit and same num
            if(data_b[i] == data_a[i]) {
                hit++;
            } else {
                //if different digit and same num
                for (int j = 0; j < 4; ++j) {
                    if (data_b[i] == data_a[j]) {
                        blow++;
                    }
                }
            }
        }
        std::cout << hit << " " << blow << std::endl;

    }
}

C++: #include <iostream>
using namespace std;
int d[4];
int main (){
      while(cin>>d[0]){
            int tmp,x=0,y=0;
            for(int j=1;j<4;j++)cin>>d[j];
            for(int j=0;j<4;j++){
                  cin>>tmp;
                  if(d[j]==tmp){x++;continue;}
                  for(int k=0;k<4;k++)if(d[k]==tmp){y++;break;}
            }
            cout<<x<<' '<<y<<endl;
      }
}