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<stdio.h>

int main()
{
int p[4]={};
int q[4]={};
int x,H,B;
H=0;B=0;
/*
for(int i=0;i<4;i++)
{scanf("%d",&x);p[i]=x;}
for(int i=0;i<4;i++)
{scanf("%d",&x);q[i]=x;}*/
while(scanf("%d %d %d %d %d %d %d %d",&p[0],&p[1],&p[2],&p[3],&q[0],&q[1],&q[2],&q[3])!=EOF)
{

for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{if(p[i]==q[j]){
	if(i==j)H++;
    else if(i!=j)B++;
}}
printf("%d %d\n",H,B);
H=0;B=0;
}

return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	
	int A[4] = {};
	int B[4] = {};
	
	int yes = 0;
	int no = 0;
	
	while( cin >> A[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++)
	for(int j=0;j<4;j++)
	if( A[i] == B[j] ) {
		
		if( i == j) 
		yes++;
		
		else
		no++;
	}
	cout << yes << " " << no << "\n"; 
}
    return 0;
}

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

using namespace std;

int main (void) {
    while (1) {
        vector<int> a(4), b(4);
        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 hi = 0, bl = 0;
        for (int i = 0; i < 4; i++) {
            if (a[i] == b[i]) {
                hi++;
            } else {
                for (int j = 0; j < 4; j++) {
                    if (b[i] == a[j]) {
                        bl++;
                        break;
                    }
                }
            }
        }
        cout << hi << ' ' << bl << endl;
    }
    return 0;
}

C++: #include <iostream>
int main()
{
	int n;
	while (std::cin>>n) {
		int a[4], b[4];
		a[0] = n;
		int eat = 0, bite = 0;
		for (int i = 1; i < 4; i++) {
			std::cin >> a[i];
		}
		for (int i = 0; i < 4; i++) {
			std::cin >> b[i];
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j&&a[i] == b[j]) {
					eat++;
				}
				else if (a[i] == b[j]) {
					bite++;
				}
			}
		}
		std::cout << eat << " " << bite << std::endl;
	}
	return 0;
}

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

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

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

int main(){
	int k = 0;
	int a[4], b[4];
	int hitto[1000] = {0}, buro[1000] = {0};
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		for(int i = 0; i < 4; i++){
			if(a[i] == b[i]){
				hitto[k]++;
			}
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j]){
					buro[k]++;
				}
			}
		}
		buro[k] = buro[k]-hitto[k];
		k++;
	}
	for(int i = 0; i < k; i++){
		cout << hitto[i] << " " << buro[i] << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    while(cin<<n){

	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int w,x,y,z;
	int hit=0,blow=0;
	cin>>w>>x>>y>>z;
	if(w==a)hit++;
	else if(w==b||w==c||w==d)blow++;
	if(x==b)hit++;
	else if(x==a||x==c||x==d)blow++;
	if(y==c)hit++;
	else if(y==b||y==a||y==d)blow++;
	if(z==d)hit++;
	else if(z==b||z==c||z==a)blow++;
	cout<<hit<<" "<<blow<<endl;
    }


	return 0;
}

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

int main()
{
	string a,b;
	while(getline(cin,a))
	{
		getline(cin,b);
		int hit=0,blow=0;

		for (int i = 0; i < 7; ++i)
		{
			for (int j = 0; j < 7; ++j)
			{
				if(b[i]!=' '&&b[i]==a[j])
				{
					if(i==j) hit++;
					else blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
bool Init(int *a, int *b);


int main()
{
	int a[4], b[4];
	int cntHits, cntBlow;
	while (Init(a, b))
	{
		cntHits = cntBlow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]) ++cntHits;
		}
		for (int i = 0; i < 4; ++i)
		{
			for (int j = 0; j < 4; ++j)
			{
				if (i != j && a[i] == b[j]) ++cntBlow;
			}
		}
		cout << cntHits << " " << cntBlow << endl;
	}
	return 0;
}
bool Init(int *a, int *b)
{
	while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3])
	{
		return true;
	}
	return false;
}

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

int main(){
	int Hit , Blow ;
	char a[4],b[4];
	while(cin >> a >> b){
		Hit = 0 , Blow = 0;
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4 ; j++){
				if(a[i] == a[j]) Blow++;
			}
		}

		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				Blow--;
				Hit++;
			}
		}

		cout << Hit << " " << Blow << "\n";
	}

}

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

C++: #include <iostream>

using namespace std;

int main(){

	int A[5];
	int B[5];
	int k = 1;

	while(1){

		int hit = 0 , blow = 0;

		for(int i = 0; i < 4; i++){
			cin >> A[i];
		}

		for(int i = 0; i < 4; i++){
			cin >> B[i];
		}

		if(A[0] == 0 || A[1] == 0 || A[2] == 0 || A[3] == 0 ||
			B[0] == 0 || B[1] == 0 || B[2] == 0 || B[3] == 0) break;

		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] && A[i] != B[i]){
					blow++;
				}
			}
		}

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

	return 0;
}

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

C++: #include<iostream>
 
 int main(){
    int a[4],b[4],hit,blow,i,j;
    while(std::cin>>a[0]){
    for(i=1;i<4;i++){
    std::cin>>a[i];
    }for(i=0;i<4;i++){
    std::cin>>b[i];
    }
    hit=0;
    blow=0;
    for(i=0;i<4;i++){
        for(j=0;j<4;j++){
            if(i==j&&a[i]==b[j]){
            hit++;
            }if(i!=j&&a[i]==b[j]){
            blow++;
            }
        }
    }
    std::cout<<hit<<" "<<blow<<std::endl;
    }
    return 0;
}

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