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]={0},b[4]={0},hi,br;
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		hi=0;
		br=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}
		}
		for(int i=0;i<4;i++){
			for(int n=0;n<4;n++){
				if(i!=n&&a[i]==b[n]){
					br++;
					cout<<br<<endl;
				}
			}
		}
		cout<<hi<<" "<<br<<endl;
	}
}

C++: #include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

int main() {
	int a[4], b[4];
	while (cin >> a[0]) {
		rep (i, 3) cin >> a[i + 1];
		rep (i, 4) cin >> b[i];

		int hit = 0, blow = 0;
		rep(i, 4) {
			rep(j, 4) {
				if (a[i] == b[j]) blow++;
			}
			if (a[i] == b[i]) {
				hit++;
				blow--;
			}
		}
		cout << hit << " " << blow << endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<int, 4> a;
  array<int, 4> b;

  while ( cin >> a[0] >> a[1] >> a[2] >> a[3] )
    {
      cin >> b[0] >> b[1] >> b[2] >> b[3];

      int ht = 0;
      int bl = 0;
      
      for ( auto i = 0; i < 4; ++i )
        for ( auto j = 0; j < 4; ++j )
          if ( a[i] == b[j] )
            if ( i == j )
              ++ht;
            else
              ++bl;
      cout << ht << " " << bl << endl;
    }
  
  return 0;
}

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

bool CheckArray(const std::vector<int>& v, const int& x)
{
	bool flg=0;

	for(size_t i=0; i<v.size(); ++i)
	{
		if(v[i]==x)
		{
			flg=1;
		}
	}

	return flg;
}

int main()
{
	const int Item =4;//ヒットアンドブローで遊ぶ数字の数

	std::vector<int> a;

	int temp=0, cHit=0, cBlow=0;

	while(1)
	{
		if(std::cin.eof())
		{
			break;
		}

		for(int i=0; i<Item; ++i)
		{
			std::cin >> temp;

			a.push_back(temp);
		}

		for(int i=0; i<Item; ++i)
		{
			std::cin >> temp;

			if(temp==a[i])
			{
				++cHit;//Hitのカウント
			}

			if(CheckArray(a,temp))
			{
				++cBlow;//tempがa[]のどれかと一致（Hit+Blow）
			}
		}

		cBlow -= cHit;

		std::cout << cHit << ' ' << cBlow << '\n';

		a.clear();

		cHit=0, cBlow=0;
	}
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int a[4],b[4],hit = 0,blow = 0;
	while(1)
	{
		for(int i = 0;i<4;i++)
		{
			if(scanf("%d",&a[i]) == EOF) goto kitune;
		}
		for(int i = 0;i < 4;i++)
		{
			scanf("%d",&b[i]);
		}

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

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

int main() {
	vector<int> a(4), b(4);
	while(!cin.eof()){
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) cin >> b[i];
		
		int hit = 0, blow = 0;
		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;
					}
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
}

C++: #include <iostream>

using namespace std;

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

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

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

int a[4], b[4];

void solve(void)
{
    int hit = 0;
    for (int i = 0; i < 4; i++) {
        if (a[i] == b[i]) {
            a[i] = 0;
            hit++;
        }
    }

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

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

int main()
{
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]
               >> b[0] >> b[1] >> b[2] >> b[3]) {
        solve();
    }
    return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int h=0,n=0;
	int a[3],b[3],dat=1;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	for(int k=0;k<4;k++){
		for(int o=0;o<4;o++){
			if(a[k]==b[k]){
				h++;
			}
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	cout<<h<<" "<<n<<endl;
	}
	return 0;
}

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

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

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    vector<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 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++;
                } else if (a[i] == b[j] && i != j) {
                    blow++;
                }
            }
        }    
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a[4];
	int b[4];
	int h=0, br=0;
	while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
		h = 0, br = 0;
		for (int i = 0; i < 4; i++){
			cin >> b[i];
		}
		for (int i = 0; i < 4; i++){
			if (a[i] == b[i]){
				h++;
				a[i] = -1;
				b[i] = -1;
			}
		}
		for (int i = 0; i < 4; i++){
			for (int i2 = 0; i2 < 4; i2++){
				if (a[i] == b[i2]&&b[i2]!=-1){
					br++;
				}
			}
		}
		cout << h << " " << br << endl;
	}
}

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

int main()
{
    int a[4];
    int b[4];
    while(cin >> 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++;
                    }
                    break;

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