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>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x=0,y=0;
    while(cin >> a >> b >> c >> d >> 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>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>

using namespace std;

const double eps=1e-10;

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;

		int c[10]={0};
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
			else{
				c[a[i]]++;
				c[b[i]]++;
			}
		}
		for(int i=0;i<10;i++)
			if(c[i]==2) blow++;

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

	}

	return 0;
}

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

int main()
{
	int a[4], b[4];
	static int ans[100][2];
	int hit, bro, count = 0;
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
		hit = 0;
		bro = 0;
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i])
				hit++;
			else {
				for (int k = 0; k < 4; k++) {
					if (a[i] == b[k])
						bro++;
				}
			}
		}
		ans[count][0] = hit;
		ans[count][1] = bro;
		count++;
	}
	for (int i = 0; i < count; i++) 
		cout << ans[i][0] << " " << ans[i][1] << endl;
}

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

int hit(std::vector<int> a, std::vector<int> b){
    int hit_count = 0;
    for(int i = 0; i < 4; ++i){
        if(a.at(i) == b.at(i)){
            hit_count += 1;
        }
    }
    return hit_count;
}

int same_number(std::vector<int> a, std::vector<int> b){
    int same_count = 0;
    for(int i = 0; i < 4; ++i){
        for(int j = 0; j < 4; ++j){
            if(a.at(i) == b.at(j)){
                same_count += 1;
            }
        }
    }
    return same_count;
}

int main(){
    std::vector<int> a_set, b_set;
    int a[4], b[4];
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        if(a[0] == -1 or a[1] == -1 or a[2] == -1 or a[3] == -1)  break;
        for(int i = 0; i < 4; ++i){
            a_set.push_back(a[i]);
        }
        std::cin >> b[0] >> b[1] >> b[2] >> b[3];
        if(b[0] == -1 or b[1] == -1 or b[2] == -1 or b[3] == -1)  break;
        for(int i = 0; i < 4; ++i){
            b_set.push_back(b[i]);
        }
        std::cout << hit(a_set, b_set) << " " << same_number(a_set, b_set) - hit(a_set, b_set) << std::endl;
        a_set.clear();
        b_set.clear();
    }
    return 0;
}

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

struct data{
	int num;
	int counted;
};

int main(){
	data a[4];
	data b[4];
	while(cin >> a[0].num >> a[1].num >> a[2].num >> a[3].num
		>> b[0].num >> b[1].num >> b[2].num >> b[3].num)
	{
		int hit = 0;
		int blow = 0;
		for(int i = 0; i < 4; i++){
			a[i].counted = 1;
			b[i].counted = 1;
		}
		for(int j = 0; j < 4; j++){
			if(a[j].num == b[j].num){
				a[j].counted = b[j].counted = 0;
				hit++;
			}
		}
		for(int k = 0; k < 4; k++){
			for(int l = k; l < 4; l++){
				if(a[k].counted == 1 && b[l].counted == 1){
					if(a[k].num == b[l].num){
						a[k].counted = b[l].counted = 0;
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<cstdio>

int date[2][4];


int main()
{
	while(scanf("%d%d%d%d%d%d%d%d",&date[0][0],&date[0][1],&date[0][2],&date[0][3],&date[1][0],&date[1][1],&date[1][2],&date[1][3])!=EOF)
	{
		int hit=0;
		int blow=0;
		for(int i=0;i<4;i++)
		{
			if(date[0][i]==date[1][i])hit++;
		}
		for(int i=0;i<4;i++)
		{
			for(int j=0;j<4;j++)
			{
				if(date[0][i]==date[1][j])blow++;
			}
		}
		blow-=hit;
		printf("%d %d\n",hit,blow);
	}
}

C++: #include <stdio.h>
  int main(){ 
	  int a[5],b[5],i,j;
	  int hit=0,blow=0;
	  while(scanf("%d %d %d %d %d %d %d %d",&a[1],&a[2],&a[3],&a[4],&b[1],&b[2],&b[3],&b[4]) != EOF){
		  for(i=1;i<=4;i++){
			  if(a[i]==b[i]){
				  hit++;
			  }
		  }
		  for(i=1;i<=4;i++){
			  for(j=1;j<= 4;j++){
				  if(j != i){
				  if(a[i]==b[j]){
					  blow++;
				  }	  
			  }
		  }
		  printf("%d %d\n",hit,blow);
		  hit=0; blow=0;
	  }
	  return 0;
  }

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

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

C++: #include <cstdio>

int main() {
    int in[8] = { 0 };

    while (true) {
        for (int i = 0; i < 8; ++i) {
            if (scanf("%d", &in[i]) == EOF) {
                return 0;
            }
        }

        int hi = 0;
        int bl = 0;

        for (int i =  0; i < 4; ++i) {
            for (int j = 4; j < 8; ++j) {
                if (in[i] == in[j]) {
                    if (i == j - 4) {
                        hi++;
                    } else {
                        bl++;
                    }
                }
            }
        }

        printf("%d %d\n", hi, bl);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

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, brow = 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 brow++;
				}
			}
		}
		cout << hit << " " << brow << endl;
	}

	
	return 0;
}

C++: #include <stdio.h>

int main(void){
	int a[4], b[4];
	int al[10];
	int hit, blow;
	while(scanf("%d %d %d %d", a, a+1, a+2, a+3) != EOF){
		scanf("%d %d %d %d", b, b+1, b+2, b+3);
		hit = blow = 0;
		for(int i=0; i<10; ++i){
			al[i] = -1;
		}
		for(int i=0; i<4; ++i){
			al[a[i]] = i;
		}
		for(int i=0; i<4; ++i){
			if(al[b[i]] == -1){ continue; }
			if(al[b[i]] == i ){ hit++; }
			else { blow++;}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

int main(){
  int a[4],c[4];
  while(1){
    int e=0,b=0,k;
    for(int i=0;i<4;i++)
      k=scanf("%d",&a[i]);
    if(k==-1)break;
    for(int i=0;i<4;i++){
      cin >> c[i];
      for(int j=0;j<4;j++)
	if(c[i]==a[j]){
	  if(i==j)e++;
	  else b++;
	}
    }
    cout<<e<<' '<<b<<endl;
  }
  return 0;
}

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

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