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 a1, a2, a3, a4, b1, b2, b3, b4, h, b;

	while(cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
		h=0;
		b=0;
		if(a1==b1)
			h++;
		if(a2==b2)
			h++;
		if(a3==b3)
			h++;
		if(a4==b4)
			h++;
		if(a1==b2||a1==b3||a1==b4)
			b++;
		if(a2==b3||a2==b4||a2==b1)
			b++;
		if(a3==b4||a3==b1||a3==b2)
			b++;
		if(a4==b1||a4==b2||a4==b3)
			b++;
		cout << h << " " << b << endl;
	}

	return 0;

}

C++: #include<iostream>
int main() {
	while (1) {
		int input[4];
		for (int i = 0; i < 4; ++i) {
			std::cin >> input[i];
		}
		int answer[4];
		for (int i = 0; i < 4; ++i) {
			std::cin >> answer[i];
		}
		int e = 0, b = 0;
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (input[i] == answer[j]) {
					if (i == j)++e;
					else ++b;
					break;
				}
			}
		}
		std::cout << e << " " << b << std::endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a[4]={0},b[4]={0},hi,br;
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		hi=0;
		br=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}
		}
		for(int i=0;i<4;i++){
			for(int n=0;n<4;n++){
				if(i!=n&&a[i]==b[n]){
					br++;
				}
			}
		}
		cout<<hi<<" "<<br<<endl;
	}
}

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){
        x=0;
        y=0;
        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, hit, blow, i, j;
  while (cin >> a[0]) {
    hit = 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;
}

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

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

C++: #include <iostream>

using namespace std;

int main(){
	int a[4];
	int b[4];
	int h=0;
	int b=0;
	int m, n;

	for(int i=0; i<4; i++){
		cin >> a[i];
	}
	for(int i=0; i<4; i++){
		cin >> b[i];
	}
	for(m=0; m<4; m++){
		for(n=0; n<4; n++){
			if(a[m] == b[n] && m == n){
				h = h+1;
			}
			else if(a[m] == b[n]){
				b = b+1;
			}
		}
		
	cout << h << " " << b << endl;
}

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

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

int main(){
	std::array(u_int, 4) a, b;
	int hit=0, blow=0;

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

    return 0;
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	int map[4];
	bool used[10];
	while(1) {
		bool eof = false;
		for(int i=0; i < 10; ++i) used[i] = false;
		for(int i=0; i < 4; ++i) {
			if(cin >> map[i]) {
				used[map[i]] = true;
			}
			else	{ eof = true; break; }
		}
		if(eof) break;
		int hit, br;
		hit = br = 0;
		for(int i=0; i < 4; ++i) {
			int inNum;
			cin >> inNum;
			if		(map[i] == inNum) ++hit;
			else if	(used[inNum]) ++br;
		}
		cout << hit << ' ' << br << endl;
	}
	return 0;
}

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

int main(void){
	int a[4];
	int b[4];
	int h,br;
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]>> b[0] >> b[1] >> b[2] >> b[3]){
		
		h=0;
		br=0;
		
		for(int k=0;k<4;k++){
			for(int l=0;l<4;l++){
				if(a[k]==b[l]){
					if(k==l) h++;
					else br++;
				}
			}
		}
		
		cout << h << ' '<< br << endl;
	}
}

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