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<math.h>
#include<vector>
using namespace std;
int main() {
	int a,i,j,k,l,m,hit,blow;
	vector<int> s,t,u;
	while (true) {
		hit = 0;
		blow = 0;
		s.clear();
		t.clear();
		for (i = 0; i < 4; i++) {
			cin >> a;
			s.push_back(a);
		}
		for (j = 0; j < 4; j++) {
			cin >> a;
			t.push_back(a);
		}
		for (k = 0; k < 4; k++) {
			if (s[k] == t[k]&&s[k]>=0) {
				hit += 1;
				s[k] = -1;
				t[k] = -1;
			}
		}
		for (l = 0; l < 4; l++) {
			for (m = 0; m < 4; m++) {
				if (s[l] == t[m] && s[l] > 0) {
					blow += 1;
					s[l] = -1;
					t[m] = -1;
				}
			}
		}
		cout << hit << " " << blow << 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", a) != EOF) {
        rep (i, 3) scanf("%d", a+i+1);
        rep (i, 4) scanf("%d", b+i);
        int h = 0, k = 0;
        rep (i, 4) if (a[i] == b[i]) h++;
        rep (i, 4) rep (j, 4) if (a[i] == b[j]) k++;
        printf("%d %d\n", h, k-h);
    }
    return 0;
}

C++: 
#include <iostream>

int main(){
    int a_num[4];
    int b_num[4];
    
    while (true) {
        
        // input a's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> a_num[i]) ){
                return 0;
            }
        }
        // input b's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> b_num[i]) ){
                return 0;
            }
        }
        
        // count hit.
        int hit=0;
        for (int i=0; i<4; ++i) {
            if (a_num[i] == b_num[i]) {
                ++hit;
            }
        }
        std::cout << hit << " ";
        
        // count blow.
        int blow=0;
        for (int i=0; i<4; ++i) {
            for (int j=0; j<4; ++j) {
                if (i==j) {
                    break;
                }
                if (b_num[i] == a_num[j]) {
                    ++blow;
                    break;
                }
            }
        }
        std::cout << blow << std::endl;
        
    }
    return 0;
}

C++: #include <iostream>

auto input (int (& a) [4] , int (& b) [4]) -> bool
{
    for (auto && elem : a)
    {
        if (! (std::cin >> elem))
        {
            return 0;
        }
    }
    for (auto && elem : b)
    {
        std::cin >> elem;
    }
    return 1;
}

auto main () -> int
{
    int a [4] , b[4];
    while (input (a , b))
    {
        auto flag = 0;
        for (auto i = 0; i < 4; ++ i)
        {
            for (auto j = 0; j < 4; ++ j)
            {
                if (a [i] == b [j])
                {
                    ++ flag;
                    break;
                }
            }
        }
        auto hit = 0;
        for (auto i = 0; i < 4; ++ i)
        {
            if (a [i] == b [i])
            {
                ++ hit;
            }
        }
        std::cout << hit << ' ' << (flag - hit) << std::endl;
    }
}

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])){
		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++;
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

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

	while (1)
	{
		hit = 0;
		blow = 0;

		cin >> a[0];
		if (cin.eof()) break;
		cin >> a[1] >> a[2] >> a[3];
		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])
				{
					if (i == j)
						hit++;
					else
						blow++;
				}
			}
		}

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

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

int main(){
    int a[4];
    int b[4];

    int hit;
    int blow;

    hit = 0;
    blow = 0;

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

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

    return 0;
}

C++: #include <stdio.h>

int main(void){
	int a[4],b[4],n,t,r,i,c,d;
	for(r=0,r<2;r++){
		c=0;
		d=0;
		for(t=0;t<4;t++){
				scanf("%d",&a[t]);
		}
		for(t=0;t<4;t++){
				scanf("%d",&b[t]);
		}
				
		for(t=0;t<4;t++){
			for(i=0;i<4;i++){
				if(b[t]==a[i]){
					c++;
				}
			}
		}
		for(i=0;i<4;i++){
			if(b[i]==a[i]){
				d++;
			}
		}
		printf("%d %d\n",d,c-d);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x=0,y=0;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h){
        x=0;
        y=0;
        if (a==e){x=x+1;} 
        if (b==f){x=x+1;} 
        if (c==g){x=x+1;}
        if (d==h){x=x+1;}
        if (e==b || e==c || e==d){y=y+1;}
        if (f==a || f==c || f==d){y=y+1;}
        if (g==a || g==b || g==d){y=y+1;}
        if (h==a || h==b || h==c){y=y+1;}
        cout << x << " " << y << endl;
    }  
return 0 ;
}

C++: #include<stdio.h>
int a[4]={0};
int b[4]={0};
int hit=0,blow=0;

int main()
{
    while(scanf("%d",&a[0])!=-1)
    {
        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])
            {
                hit++;
                a[i]=0;
                b[i]=0;
            }
        }
        for(int i=0;i<4;i++)
        {
            if(b[i]!=0)
            {
                for(int j=0;j<4;j++)
                {
                    if(b[i]==a[j])
                    {
                        blow++;
                    }
                }
            }
        }
        printf("%d %d\n",hit,blow);
        for(int i=0;i<4;i++)
        {
            a[i]=0;
            b[i]=0;
        }
        hit=0;
        blow=0;
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

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 match = 0;
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (a[i] == b[j]) ++match;
			}
		}
		int hit = 0;
		for (int i = 0; i < 4; ++i) {
			if (a[i] == b[i]) ++hit;
		}
		cout << hit << ' ' << match - hit << endl;
	}
	return 0;
}