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>

auto input (int (& a) [4] , int (& b) [4]) -> bool
{
    for (auto && elem : a)
    {
        if (! (std::cin >> elem))
        {
            return 0;
        }
    }
    for (auto && elem : b)
    {
        std::cin >> elem;
    }
    return 1;
}

auto main () -> int
{
    int a [4] , b[4];
    while (input (a , b))
    {
        auto flag = 0;
        for (auto i = 0; i < 4; ++ i)
        {
            for (auto j = 0; j < 4; ++ j)
            {
                if (a [i] == b [j])
                {
                    ++ flag;
                    break;
                }
            }
        }
        auto hit = 0;
        for (auto i = 0; i < 4; ++ i)
        {
            if (a [i] == b [i])
            {
                ++ hit;
            }
        }
        std::cout << hit << ' ' << (flag - hit) << std::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])){
		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++: #include <iostream>
using namespace std;

int main()
{
	int a[4], b[4], hit, blow;

	while (1)
	{
		hit = 0;
		blow = 0;

		cin >> a[0];
		if (cin.eof()) break;
		cin >> 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++;
				}
			}
		}

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

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

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

    int hit;
    int blow;

    hit = 0;
    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 <stdio.h>

int main(void){
	int a[4],b[4],n,t,r,i,c,d;
	for(r=0,r<2;r++){
		c=0;
		d=0;
		for(t=0;t<4;t++){
				scanf("%d",&a[t]);
		}
		for(t=0;t<4;t++){
				scanf("%d",&b[t]);
		}
				
		for(t=0;t<4;t++){
			for(i=0;i<4;i++){
				if(b[t]==a[i]){
					c++;
				}
			}
		}
		for(i=0;i<4;i++){
			if(b[i]==a[i]){
				d++;
			}
		}
		printf("%d %d\n",d,c-d);
	}
	return 0;
}

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;} 
        if (b==f){x=x+1;} 
        if (c==g){x=x+1;}
        if (d==h){x=x+1;}
        if (e==b || e==c || e==d){y=y+1;}
        if (f==a || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==d){y=y+1;}
        if (h==a || h==b || h==c){y=y+1;}
        cout << x << " " << y << endl;
    }  
return 0 ;
}

C++: #include<stdio.h>
int a[4]={0};
int b[4]={0};
int hit=0,blow=0;

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

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

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

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

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

int main(void){
  int a[4]={0},b[4]={0},Hit=0,Blow=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] && i == j ) Hit++;
      else if( a[i] == b[j] && i != j ) Blow++;

    }
  }

  cout << Hit <<" "<< Blow << endl;

  return 0;
}

C++: #include<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow;
	double stoped;
	
	

		hit=0,brrow=0;
	
		for(i=0;i<4;i++){
			scanf("%d",&a[i]);
		}

		for(i=0;i<4;i++){
			scanf("%d",&b[i]);
		}

		for(i=0;i<4;i++){		//hit
			if(a[i]==b[i]){
				hit++;
			}
		}
	
		for(i=0;i<4;i++){		//brrow
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					brrow++;
				}
			}
		}	
		printf("%d %d\n",hit,brrow);
	
	return 0;
}

C++: #include <stdio.h>

int main(void) {

  int a[4];
  int b[4];

  int hit,blow;

  int i,j;
  char c;

  while(1) { 
   
    if(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==EOF || scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3])==EOF) break;

    //fflush(stdin);
    hit=blow=0;
    
    for(i=0;i<4;i++) {
       
      for(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<bits/stdc++.h>
using namespace std;
int main(void){
	int a[4],b[4],flg[4];
	int i,j;
	int hit,blow;
	
	while(1){
		cin>>a[0];
		if(cin.eof()==1)	break;
		for(i=1;i<4;i++){
			cin>>a[i];
			flg[i]=0;
		}
		for(i=0;i<4;i++)	cin>>b[i];
		hit=0;
		blow=0;
		for(i=0;i<4;i++){
			if(a[i]==b[i]){
				hit++;
				flg[i]=1;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(i!=j||flg[j]==0){
					if(a[i]==b[j])	blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

C++: a[4],b[4];main(){int i,j,h,l;for(;~scanf("%d%d%d%d%d%d%d%d",a,a+1,a+2,a+3,b,b+1,b+2,b+3);printf("%d %d\n",h,l))for(i=h=l=0;i<4;i++)for(j=0;j<4;j++)if(a[i]==b[j])i==j?h++:l++;exit(0);}