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 <cstdio>
#include <iostream>
using namespace std;
int main()
{
    int a[5],b[5],t1,t2;
	while(scanf("%d%d%d%d",a+1,a+2,a+3,a+4)!=EOF)
	{
		scanf("%d%d%d%d",b+1,b+2,b+3,b+4);
		t1=t2=0;
		for (int i=1;i<=4;i++)
		{
			if (a[i]==b[i]) t1++;
			for (int j=1;j<=4;j++) if (i!=j&&a[i]==b[j]) t2++;
		}
		cout<<t1<<" "<<t2<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

#define rep(i, n) for(int i=0; i<(int)(n); i++)

int main()
{
	int a[4], b[4];
	while(scanf("%d%d%d%d%d%d%d%d", a, a+1, a+2, a+3, b, b+1, b+2, b+3)!=EOF) {
		int hit=0, blow=0;
		rep(i, 4) rep(j, 4) if(a[i]==b[j]) {
			if(i==j) hit++;
			else blow++;
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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]))
	{
		bool v[4];
		int ch=0,cb=0;
		for(int i=0;i<4;i++)v[i]=true;
		for(int i=0;i<4;i++)
		{
			if(a[i]==b[i])
			{
				v[i]=false;
				ch++;
			}
		}
		for(int i=0;i<4;i++)
		{
			for(int j=0;v[i]&&j<4;j++)
			{
				if(a[i]==b[j])
				{
					cb++;
				}
			}
		}
		cout<<ch<<" "<<cb<<endl;
	}
	return 0;
}

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

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

int main(){

  std::stack<int> st;

  int N = 0;
  int a;

  while(N <= 100 && std::cin >> a){
    if(a != 0){
      st.push(a);
    }
    else{
      std::cout << st.top() << std::endl;
      st.pop();
	}
    ++N;
  }
}

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 <cmath>
#include <vector>


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

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

C++: #include<stdio.h>
int main()
{
	int a[4],b[4],hi,bl;
	while(!(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]),scanf("%d%d%d%d",&b[0],&b[1],&b[2],&b[3])==EOF)){
		hi=0;
		bl=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}else if(a[i]==b[0]||a[i]==b[1]||a[i]==b[2]||a[i]==b[3]){
				bl++;
			}
		}
		printf("%d %d\n",hi,bl);
	}
	return 0;
}

C++: #include<stdio.h>
main(){
  int a[5],b[5],coh=0,cob=0,i,j;
  
  scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
  scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
  
  for(i=0;i<4;i++){

    if(a[i]==b[i]) coh++;

    for(j=0;j<4;j++){
	if(j!=i){

	  if(a[i]==b[j]) cob++;

	}
    }
  }
  printf("%d %d\n",coh,cob);
  
  return 0;
}

C++: #include <iostream>

int main(void)
{
	while(true)
	{
		int a[10]={0},b[10]={0},n;
		for(int i=1; i<=4; i++)
		{
			if(!(std::cin >> n))
				return 0;
			a[n]=i;
		}
		for(int i=1; i<=4; i++)
		{
			if(!(std::cin >> n))
				return 0;
			b[n]=i;
		}

		int hit=0,blow=0;
		for(int i=0; i<=9; i++){
			if(b[i] == 0)
				continue;
			if(a[i] == b[i])
				hit++;
			else if(a[i]!=0)
				blow++;
		}
		std::cout << hit << " " << blow << std::endl;
	}
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  vi a(4), b(4);
  while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
    vi c, d;
    int s = 0;
    rep(i, 4) {
      if (a[i] == b[i]) {
        s++;
      } else {
        c.pb(a[i]), d.pb(b[i]);
      }
    }
    vi interset;
    sort(all(c));
    sort(all(d));
    set_intersection(all(c), all(d), back_inserter(interset));
    cout << s << ' ' << interset.size() << endl;
  }
}

C++: #include<iostream>

using namespace std;


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

  while(cin >> a[0]>> a[1]>> a[2]>>a[3]){
    blow = 0;hit=0;
    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++;
      }
    }

    cout << hit <<" "<< blow<< endl;//
  }


  return 0;
}