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[4],b[4];
	while(1){
		int 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[i]){
					hit++;
					break;
				}else if(a[i] == b[j] && i!=j){
					blow++;
					break;
				}
			}
		}
		cout<<hit<<" "<<blow<<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] ;
        /*int t = 0;
        for(int j = 0;j < 4;j++){
            if(a[j][i] != 0){
                t = 1;
                j = 4;
            }
            if(b[j][i] != 0){
                t = 1;
                j = 4;
            }
        }
        if (t == 0){
            n = i;
            i = 50;
        }*/
    } 
    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;
    }
}

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

C++: #include <iostream>
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 j = 0; i < 4; j++){
        if (a[i] == b[j]){
          blow++;
        }
      }
    }
    blow -= hit;
    cout << hit << " " << blow << endl;
  }

  return 0;
}

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

int main() 
{
  int a[4];
  int b[4];
  int brow, hit;
  while(cin>> a[0] >> a[1] >> a[2] >>a[3] >> b[0] >> b[1] >> b[2] >> b[3])
  {
    hit = brow = 0;
    for(int i = 0; i < 4; i  )
    {
      for(int j = 0; j < 4; j  )
      {
        if(a[i] == b[j])
        {
          brow  ;
          break;
        }
      }
    }
    for(int i = 0; i < 4; i  )
    {
      if(a[i] == b[i])
      {
        hit  ;
      }
    }
    cout << hit << " " << brow - hit << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int a[4], b[4];
    while (cin>>a[0])
    {
        rep(j, 3) cin >> a[j+1];
        rep(j, 4) cin >> b[j];
        int hit = 0, bl = 0;
        rep(i, 4)
        {
            rep(j, 4)
            {
                if (a[i] == b[j])
                {
                    if (i == j)
                        hit++;
                    else
                        bl++;
                }
            }
        }
        cout << hit << ' ' << bl << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int hit(int a[],int b[]);
int blow(int a[], int b[]);
int main(){
    int a[4];
    int b[4];
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
        if (cin.eof()){break;}
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

int hit(int a[],int b[]){
    int n=0;
    for (int i=0; i<4;i++){
        if (a[i]==b[i])
            n++;
    }
    return n;
}

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

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

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

        cout << hit << ' ' << blow << endl;
    }
}

C++: #include<iostream>

int main(){
	int a[4],b[4],i,n,hit=0,blow=0;


	while(std::cin>>a[0]){

	for(i=0;i<4;i++){
		std::cin>>a[i];
	}
	for(i=0;i<4;i++){
		std::cin>>b[i];
	}

	for(i=0;i<4;i++){
		for(n=0;n<4;n++){
			if(a[i]==b[n]){
				blow ++;
				if(i==n){
					hit++;
					blow--;
				}
			}
		}
	}

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



}

C++: #include<iostream>

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

    }
}