Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	a := make([]int, 4)
	b := make([]int ,4)
	for scanner.Scan() {
		inputa := strings.Split(scanner.Text(), " ")
		for i := range a {
			a[i], _ = strconv.Atoi(inputa[i])
		}
		scanner.Scan()
		inputb := strings.Split(scanner.Text(), " ")
		for i := range b {
			b[i], _ = strconv.Atoi(inputb[i])
		}
		hit := 0
		blow := 0
		if a[0] == b[0] {
			hit++
		}
		if a[1] == b[1] {
			hit++
		}
		if a[2] == b[2] {
			hit++
		}
		if a[3] == b[3] {
			hit++
		}
		if a[0] == b[1] {
			blow++
		}
		if a[1] == b[2] {
			blow++
		}
		if a[2] == b[3] {
			blow++
		}
		if a[1] == b[0] {
			blow++
		}
		if a[2] == b[1] {
			blow++
		}
		if a[2] == b[0] {
			blow++
		}
		if a[3] == b[2] {
			blow++
		}
		if a[3] == b[1] {
			blow++
		}
		if a[3] == b[0] {
			blow++
		}
		if a[0] == b[2] {
			blow++
		}
		if a[1] == b[3] {
			blow++
		}
		if a[0] == b[3] {
			blow++
		}
		fmt.Printf("%d %d\n", hit, blow)
	}
}

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

int main() {
	vector<int> a(4), b(4);
	while( cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		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;
	}
}

C++: #include <cstdio>

int main() {
    int in[8] = { 0 };

    while (true) {
        for (int i = 0; i < 8; ++i) {
            if (scanf("%d", &in[i]) == EOF) {
                return 0;
            }
        }

        int hi = 0;
        int bl = 0;

        for (int i =  0; i < 4; ++i) {
            for (int j = 4; j < 8; ++j) {
                if (in[i] == in[j]) {
                    if (i == j - 4) {
                        hi++;
                    } else {
                        bl++;
                    }
                }
            }
        }

        printf("%d %d\n", hi, bl);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

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

	
	return 0;
}

C++: #include <stdio.h>

int main(void){
	int a[4], b[4];
	int al[10];
	int hit, blow;
	while(scanf("%d %d %d %d", a, a+1, a+2, a+3) != EOF){
		scanf("%d %d %d %d", b, b+1, b+2, b+3);
		hit = blow = 0;
		for(int i=0; i<10; ++i){
			al[i] = -1;
		}
		for(int i=0; i<4; ++i){
			al[a[i]] = i;
		}
		for(int i=0; i<4; ++i){
			if(al[b[i]] == -1){ continue; }
			if(al[b[i]] == i ){ hit++; }
			else { blow++;}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

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

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

int main() {
  int a[4],b[4],hit,blow;
  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++) {
      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;
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#include <set>
#include <map>
//#include <bits/stdc++.h>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
#define ll long long
#define bl bool
#define nn printf("\n");
#define mod 1000000007

using namespace std;

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

	while (1)
	{
		vector<int> a(4, 0), b(4, 0);
		int hit = 0, blow = 0;
		rep(i, 4) { cin >> a[i]; }
		rep(i, 4) { cin >> b[i]; }
		rep(i, 4)
		{
			if (a[i] == b[i]) { hit += 1; }
		}
		rep(i, 4)
		{
			blow += count(all(b), a[i]);
		}
		printf("%d %d\n", hit, blow - hit);
	}
	


	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int h = 0, v = 0;
	int a[5], b[5];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	while (cin >> b[0] >> b[1] >> b[2] >> b[3]){
		REP(i,4){
			REP(j, 4){
				if (b[i] == a[j]){
					v++;
					if (i == j){
						v--;
						h++;
					}
				}
			}
		}
		cout << h << " " << v << endl;
		h = v = 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(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;

		hit = 0;
		blow = 0;
	}

}

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

using namespace std;

bool testcase_ends() {
    vector<int> a(4);
    for (size_t i=0; i<4; ++i)
        if (scanf("%d", &a[i]) == EOF)
            return 1;

    vector<int> b(4);
    for (size_t i=0; i<4; ++i)
        scanf("%d", &b[i]);

    int hit=0, blow=0;
    for (size_t i=0; i<4; ++i)
        for (size_t j=0; j<4; ++j)
            if (a[i] == b[j])
                ++(i==j? hit:blow);

    printf("%d %d\n", hit, blow);
    return 0;
}

int main() {
    int solved=0;
    while (!testcase_ends())
        ++solved;

    return !solved;
}

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

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

int main()
{
	int i,j;
	int a[4];
	int b[4];
	while(1){

		int hit =  0;
		int blow = 0;
		if(cin.eof())return;
		for(i=0;i<4;++i)cin>>a[i];
		for(i=0;i<4;++i)cin>>b[i];

		for(i=0;i<4;++i){
			for(j=0;j<4;++j){
				if(b[i] == a[j]){
					(j == i) ? ++hit : ++blow;
				}
			}
		}
		cout << hit << ' ' << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>

#define int64 long long int

using namespace std;

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