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 <sstream>
#include <string>

int a[4], b[4];

void split(std::string s, std::string t) {
    a[0] = s[0]-'0'; b[0] = t[0]-'0';
    a[1] = s[2]-'0'; b[1] = t[2]-'0';
    a[2] = s[4]-'0'; b[2] = t[4]-'0';
    a[3] = s[6]-'0'; b[3] = t[6]-'0';
}

void solve() {
    int 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++;
                }
            }
        }
    }
    std::cout << hit << ' ' << blow << std::endl;
}

int main(void) {
    std::string line_1, line_2;
    while (std::getline(std::cin, line_1)) {
        std::getline(std::cin, line_2);
        split(line_1, line_2);
        solve();
    }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		vector <int> A(4);
		vector <int> B(4);

		for ( int i = 0; i < 4; i++ )
		{
			cin >> A[i];
		}

		for ( int i = 0; i < 4; i++ )
		{
			cin >> B[i];
		}

		if ( cin.eof() )
			break;

		int blow = 0;
		for ( vector <int>::iterator it = B.begin(); it != B.end(); it++ )
		{
			if ( find( A.begin(), A.end(), *it ) != A.end() )
			{
				blow ++;
			}
		}

		vector <int>::iterator it_a = A.begin();
		vector <int>::iterator it_b = B.begin();

		int hit = 0;
		while ( it_a != A.end() )
		{
			if ( *it_a == *it_b )
				hit++;
			it_a++;
			it_b++;
		}

		blow -= hit;

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

	}

	return 0;
}

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

int main(){
	int a1, a2, a3, a4;
	int b1, b2, b3, b4;
	int hit = 0;
	int blow = 0;

	while(cin >> a1 >> a2 >> a3 >> a4){
		cin >> b1 >> b2 >> b3 >> b4;

		hit = 0;
		blow = 0;


		if(a1 == b1){
			hit++;
		}
		if(a2 == b2){
			hit++;
		}
		if(a3 == b3){
			hit++;
		}
		if(a4 == b4){
			hit++;
		}
		if(a1 == b2 || a1 == b3 || a1 == b4){
			blow++;
		}
		if(a2 == b1 || a2 == b3 || a2 == b4){
			blow++;
		}
		if(a3 == b1 || a3 == b2 || a3 == b4){
			blow++;
		}
		if(a4 == b1 || a4 == b2 || a4 == b3){
			blow++;
		}

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

}

C++: #include<iostream>
int main(){
	int a[4],b[4],i,n,hit,blow;
	
		while(std::cin>>a[0]){
		hit=0;
		blow=0;
		for(i=1;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]){
					if(i==n){
						hit++;
						}
					else blow++;
					}
				}
			}
		
		std::cout<<hit<<" "<<blow<<std::endl;
		}
	return 0;
	
	
	}

C++: #include<cstdio>

int main(){
	int a[4];
	int hit, blow, t;
	while(scanf("%d %d %d %d", &a[0],&a[1],&a[2],&a[3]) + 1){
		hit = blow = 0;
		for(int i = 0; i < 4; i++){
			scanf("%d", &t);
			for(int j = 0; j < 4; j++){
				if(t == a[j]){
					if(i - j){
						blow++;
					}else{
						hit++;
					}
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
    int a[4],b[4];
    int d[10];
    int n,m;
    while(scanf("%d",&a[0])!=EOF)
    {
        n=m=0;
        memset(d,0,sizeof(d));
        d[a[0]]++;
        for(int i=1; i<4; i++)
        {
            scanf("%d",&a[i]);
            d[a[i]]++;
        }
        for(int i=0; i<4; i++)
        {
            scanf("%d",&b[i]);
            if(a[i]==b[i])
                n++;
            else
            {
                d[b[i]]++;
                if(d[b[i]]==2)
                    m++;
            }
        }
        printf("%d %d\n",n,m);
    }
    return 0;
}

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

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

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

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

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

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

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

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

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

int main(){
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (std::cin >> a1 >> a2 >> a3 >> a4) {
		std::cin >> b1 >> b2 >> b3 >> b4;
		std::vector<int> a = {a1, a2, a3, a4};
		std::vector<int> b = {b1, b2, b3, b4};
		int hit = 0, blow = 0;
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (a.at(i) == b.at(j)) {
					if (i == j) {
						++hit;
					} else {
						++blow;
					}
				}
			}
		}
		std::cout << hit << " " << blow << std::endl;

	}
	return 0;
}

C++: #include <iostream>
using namespace std;
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 hit = 0, brow = 0;
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[i]) {
				hit++;
			}
		}
		for(int i = 0; i < 4; i++) {
			if(a[i] == b[(i + 1) % 4]) {
				brow++;
			}
			if(a[i] == b[(i + 2) % 4]) {
				brow++;
			}
			if(a[i] == b[(i + 3) % 4]) {
				brow++;
			}
		}
		cout << hit << " " << brow << endl;
	}

	return 0;
}

C++: #include<iostream>
int main()
{
    int hit[4]={},blow[4]={};
    while(cin>>hit[0]){
        int ans1=0,ans2=0;
        for(int i=1; i<4; i++){
            cin>>hit[i];
        }
        for(int i=0; i<4; i++){
            cin>>blow[i];
        }
        for(int i=0; i<4; i++){
            for(int j=0; j<4; j++){
                if(hit[i]==blow[j]){
                    (i==j)?ans1++:ans2++;
                }
            }
        }
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){

  int a[4],b[4],n,m;

  while(cin >> a[0]){
    n = 0;
    m = 0;
    cin >> a[1] >> a[2] >> a[3];
    for(int i=0;i<4;i++){
      cin >> b[i];
      if(a[i] == b[i]) n++;
    }
    sort(a,a+4);
    for(int i=0;i<4;i++){
      if(*lower_bound(a,a+4,b[i])==b[i]) m++;
    }
    cout << n << " " << (m-n) << endl;
  }
  return (0);
}

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

using namespace std;

int main()
{
	int numa[4];
	int numb[4];
	int a, i, j;
	int hit, blow;
	

	while(cin >> numa[0] >> numa[1] >> numa[2] >> numa[3] >> numb[0] >> numb[1] >> numb[2] >> numb[3] )
	{	
		hit = 0;
		blow = 0;
		
		for(i = 0; i < 4; i++)
		{
			if(numa[i] == numb[i])
			{
				hit = hit + 1;
			}
				for(j = 0; j < 4; j++)
				{
					if(numa[i] == numb[j] && i != j)
					{
						blow = blow + 1;
					}		
				}
		}
		cout << hit << " " << blow << endl;
	}
		
	return 0;
		
}