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];
    int c[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>c[0]>>c[1]>>c[2]>>c[3]){
        int h=0,b=0;
        for(int i=0;i<4;i++){
            if(a[i]==c[i])
                h++;
            else{
                for(int j=0;j<4;j++){
                    if(a[i]==c[j]){
                        b++;
                        break;
                    }
                }
            }
        }
    }
    return 0;
}

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

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

C++: #include<vector>
#include<iostream>
using namespace std;
int main() {
	int code[4], line, hit, bro;
	while (cin>>code[0]) {
		hit = 0;
		bro = 0;
		for (int i = 1; i < 4; ++i) {
			cin >> code[i];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> line;
			if (code[i] == line) {
				++hit;
			}
			else {
				for (int i2 = 0; i2 < 4; ++i2) {
					if (code[i2] == line) {
						++bro;
					}
				}
			}
		}
		cout << hit << " " << bro << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int a[15],b[5],c[5],i,j,hit,blow;
    while(scanf("%d%d%d%d",&b[1],&b[2],&b[3],&b[4])!=EOF)
    {
        hit=blow=0;
        memset(a,0,sizeof(a));
        scanf("%d%d%d%d",&c[1],&c[2],&c[3],&c[4]);
        for(i=1;i<=4;i++)
        {
            a[b[i]]++;
            a[c[i]]++;
            if(b[i]==c[i]){hit++;a[b[i]]=0;}
        }
        for(i=0;i<=9;i++)
        {
            if(a[i]==2)
            {
                blow++;
            }
        }
        printf("%d %d\n",hit,blow);
    }
    return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main() {
  char *line = NULL;
  size_t buffer_size;
  while (getline(&line, &buffer_size, stdin) > 0) {
    int answer[4];
    int guess[4];
    sscanf(line, "%d %d %d %d", answer, answer+1, answer+2, answer+3);
    getline(&line, &buffer_size, stdin);  // Should be always success.
    sscanf(line, "%d %d %d %d", guess, guess+1, guess+2, guess+3);

    int hit = 0;
    for (int i = 0; i < 4; ++i) {
      if (answer[i] == guess[i]) { ++hit; }
    }
    sort(answer, answer+4);
    sort(guess, guess+4);
    int intersection[] = { -1, -1, -1, -1 };
    set_intersection(answer, answer+4, guess, guess+4, intersection);
    int blow = -hit;
    for (int i = 0; i < 4; ++i) {
      if (intersection[i] < 0) { break; }
      ++blow;
    }
    printf("%d %d\n", hit, blow);
  }
  free(line);

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x,y;
    cin >> a >> b >> c >> d;
    cin >> e >> f >> g >> h;
    while(1){
        if (a==e){x++;e=e+10;} 
        if (b==f){x++;f=f+10;} 
        if (c==g){x++;g=g+10;}
        if (d==h){x++;h=h+10;}
        if (e==a||e==b||e==c||e==d){y++;}
        if (f==a||f==b||f==c||f==d){y++;}
        if (g==a||g==b||g==c||g==d){y++;}
        if (h==a||h==b||h==c||h==d){y++;}
        cout << x << y << endl;
    
    
    }
return 0 ;
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>
#include <numeric>
#include <sstream>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

//================================================

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int A1, A2, A3, A4;
	int B1, B2, B3, B4;
	while (cin >> A1 >> A2 >> A3 >> A4) {
		int hit = 0, blow = 0;
		vector<int>A(4);
		vector<int>B(4);

		A[0] = A1; A[1] = A2; A[2] = A3; A[3] = A4;
		REP(i, 4) cin >> B[i];

		REP(i, 4) {
			REP(j, 4) {
				if (A[i] == B[j]) {
					if (i == j) {
						hit++;
					} else {
						blow++;
					}
				}
			}
		}
		cout << hit << " " << blow << "\n";
	}
	return 0;
}

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

main(){
  int a[4],c[4];
  while(1){
    int e=0,b=0;
      for(int j=0;j<4;j++)
	cin >> c[j];

      for(int i=0;i<4;i++){
	cin >> a[i];
      for(int j=0;j<4;j++)
	if(a[i]==c[j]){
	  if(i==j)e++;
	  else b++;
	}
      }
    cout<<e<<' '<<b<<endl;
  }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.hb", "r", stdin);
	string str = "";
	
	while (getline (cin, str ) ) {
		vector <int> A(4, 0);
		int i,j;

		stringstream ssa (str );
		for (i = 0; i < 4; ++i){
			ssa >> A[i];
		} // end for

		getline (cin, str );
		vector <int> B (4, 0 );

		stringstream ssb (str );
		for (i = 0; i < 4; ++i){
			ssb >> B[i];
		} // end for

		int hit = 0;
		int blow = 0;

		for (i = 0; i < 4; ++i){
			if (A[i] == B[i]){
				++hit;
				A[i] = B[i] = -1;
			} // end if
		} // end for
		
		for (i = 0; i < 4; ++i){
			for (j = 0; j < 4; ++j){
				if (A[i] != -1 && B[j] != -1 && A[i] == B[j]){
					++blow;
					A[i] = B[j] = -1;
				} // end if
			} // end for
		} // end for
		cout << hit << ' ' << blow << endl;
	} // end while

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

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

int main() {
  int a[4], b[4];
  while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    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]) {
          i == j ? hit++ : blow++;
          break;
        }
      }
    }
    cout << hit << " " << blow << "\n";
  }
}

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

int main(){
  std::array<int, 4> a = {};
  std::array<int, 4> b = {};
  int hit = 0;
  int blow = 0;
  int N = 0;

  while(N <= 50 && std::cin >> a[0] >> a[1] >> a[2] >> a[3] && std::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] && i == j)
	  ++hit;
	if(a[i] == b[j] && i != j)
	  ++blow;
      }
    }
    std::cout << hit << " " << blow << std::endl;

    hit = 0;
    blow = 0;
    ++N;
  }
}