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

using namespace std;

int main(){
    int a[4], b[4], hit, blow;
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3])
    {
        for(int i = 0 ; i < 4 ; i++)
        {
            cin >> b[i];
        }
        hit = 0;
        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++;
                    }
                }
                
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++: #include <stdio.h>
 
int main( ) {                                                                  
    int a[4];
	int b[4];
	int hit;
	int blow;

	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]) != EOF ){
		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[i] ){
					blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}

    return 0;                                                                  
}

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

int main()
{
	int a[5],b[5];
	
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3])){
		int hit=0,blow=0;
		
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		
		for(int i=0; i < 4; i++){
			if(a[i] == b[i]){
				hit++;
				continue;
			}
			blow = count(a,a+4,b[i]);
		}
		printf("%d %d\n", hit, blow);
	}
	
	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 <set>
#include <array>
#include <iostream>

int main(){
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
    blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
      }
    }
    std::cout << num << " " << 8-(int)(blowing.size())-num << std::endl;
    blowing.clear();
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n[4],n2[4],hit,blow;
  while(cin>>n[0]>>n[1]>>n[2]>>n[3]>>n2[0]>>n2[1]>>n2[2]>>n2[3]){
    hit = 0;
    blow = 0;
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
      if(n[i]==n2[j]&&i==j) hit++;
      else if(n[i]==n2[j]) blow++;
      }
    }
    cout << hit << ' ' << blow << 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]){
        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] && i!=j)
                n++;
        }
    }
    return n;
}

C++: #include <iostream>

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

	while (std::cin
		>> a[0] >> a[1] >> a[2] >> a[3]
		>> b[0] >> b[1] >> b[2]	>> b[3]
	) {
		for (int i = 0; i < size; i++)
			if (a[i] == b[i]) {
				hit++;
			} else {
				for (int j = 0; j < size; j++)
					if (a[i] == b[j])
						blow++;
			}

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

C++: #include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;

#define clr(p,v) memset(p,v,sizeof(p))

int main()
{
	int a[4],b[4],ans,res;
	bool vis[4];
	while(scanf("%d",&a[0])==1)
	{
		ans = res = 0;
		clr(vis,true);
		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]) { ans++;vis[i]=false; }
		for(int i=0;i<4;i++) if(vis[i])
			for(int j=i+1;j<4;j++) if(vis[j])
			{
				if(a[i] == b[j])
				{
					vis[j] = false;
					res++;
				}
			}
		printf("%d %d\n",ans,res);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
int main()
{
	std::vector<int> a(4);
	
	while (std::cin >> a[0] >> a[1] >> a[2] >> a[3])
	{
		int hit  = 0;
		int blow = 0;

		for (auto i : a) {
			int b;
			std::cin >> b;
			std::vector<int>::iterator it = find(a.begin(), a.end(), b);
			if (b == a[i]) {
				hit++;
			}
			else if (it != a.end()) {
				blow++;
			}
		}
		std::cout << blow << ' ' << hit<< std::endl;
	}
}

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()
{
    while (!cin.eof())
    {
        int a[4], b[4];
        rep(j, 4) cin >> a[j];
        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 main() {

  int a[4],b[4];

  while(true) {

    if ( cin.eof() ) break;

    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;

  }

}

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

int main() {
  vector<int> a(4);
  while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
    map<int, int> mp;
    for (int i = 0; i < 4; ++i) mp[a[i]] = i + 1;
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; ++i) {
      int b; cin >> b;
      if (mp[b] > 0) {
        ++( (i + 1 == mp[b]) ? hit : blow );
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

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

int main()
{
    int a[4],b[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3],!cin.eof()){
        int Hit=0,Blow=0;
        bool hantei[4];
        cin>>b[0]>>b[1]>>b[2]>>b[3];
        if(cin.eof()){
            break;
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i]){
                Hit++;
                hantei[i]=true;
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(i==j){
                    continue;
                }
                if(!(hantei[i]) && b[i]==a[j]){
                    Blow++;
                    break;
                }
            }
        }
        cout<<Hit<<' '<<Blow<<endl;
    }
    return 0;
}