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>
using namespace std;
int main() {
	int a, b, c, d, e, f, g, h;
	int hit, blow;
	while (cin >> a >> b >> c >> d >> e >> f >> g >> h) {
		hit = 0;
		blow = 0;
		if      (a == e){
			//cout << "11" << endl;
			hit += 1;
		}
		else if (a == f){
			//cout << "12" << endl;
			blow += 1;
		}
		else if (a == g) {
			//cout << "13" << endl;
			blow += 1;
		}
		else if (a == h) {
			//cout << "14" << endl;
			blow += 1;
		}
		if (b == e) {
			//cout << "21" << endl;
			blow += 1;
		}
		else if (b == f) {
			//cout << "22" << endl;
			hit += 1;
		}
		else if (b == g) {
			//cout << "23" << endl;
			blow += 1;
		}
		else if (b == h) {
			//cout << "24" << endl;
			blow += 1;
		}
		if (c == e) {
			//cout << "31" << endl;
			blow += 1;
		}
		else if (c == f) {
			//cout << "32" << endl;
			blow += 1;
		}
		else if (c == g) {
		//	cout << "33" << endl;
			hit += 1;
		}
		else if (c == h) {
	//		cout << "34" << endl;
			blow += 1;
		}
		if (d == e) {
	//		cout << "41" << endl;
			blow += 1;
		}
		else if (d == f) {
	//		cout << "42" << endl;
			blow += 1;
		}
		else if (d == g) {
	//		cout << "43" << endl;
			blow += 1;
		}
		else if (d == h) {
	//		cout << "44" << endl;
			hit += 1;
		}
		cout << hit <<" "<< blow << 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]) != EOF){
		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++: //0025 Hit and Blow
//4ツ古つづ個青板篠堋づ粂IT(ツ湘ェツ渉環、ツ値ツつェツ暗ェツ致ツ）ツ、Blow(ツ湘ェツ渉環づ債暗。ツつ、ツつェツ値ツづ債暗ェツ致ツ）ツづ個古つ青板づーツ板サツ津ィツつケツづヲ

#include<iostream>
#include<algorithm>
using namespace std;

int main(void)
{
	const int N = 4;
	int a[N], b[N];
	int i;

	while(1)
	{
		for(i = 0; i < N; i++)
			cin >> a[i];
		for(i = 0; i < N; i++)
			cin >> b[i];
		if(!cin)
			break;

		int hit = 0,
			blow = 0;
		for(i = 0; i < N; i++)
		{
			if(a[i] == b[i])
				hit++;
			else if(find(a, a+N, b[i]) != a+N)
				blow++;
		}

		cout << hit << ' ' << blow << endl;
	}
	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, blow = 0;
         
        for(int i = 0; i < 4; ++i){
            int b;
            std::cin >> b;
             
            auto it = std::find(a.begin(), a.end(), b);
            if(it == a.begin() + i){
				++hit;
			}
            else if(it != a.end()){
				++blow;
			}
        }
        std::cout << hit << " " << blow << std::endl;
    }
    
    return 0;
}

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

int hit(int a[], int b[]) {
    int cnt = 0;
    for(int r = 0; r < 4; r++) {
        if(a[r] == b[r]) cnt++;
    }
    return(cnt);
}

//少し未完成なblow
int blow(int a[], int b[]) {
    int cnt = 0;
    for(int r = 0; r < 4; r++) {
        for(int c = 0; c < 4; c++) {
            if(a[r] == b[c]) cnt++;
        }
    }
    return(cnt);
}

int main(void) {
    int a[4], b[4];
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
        int hi = hit(a, b);
        int bl = blow(a, b) - hi;
        cout << hi << " " << bl << endl;
    }
    return(0);
}

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

int main(){
    std::array<int, 4> a; //player A
    std::array<int, 4> b; //player 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];      
        //if(a[0] == a[1] == a[2] == a[3] == b[0] == b[1] == b[2] == b[3] == -1)
	//break;

	//    std::cout << b[0];
    
    for(int i=0; i<a.size(); ++i){
        for(int j=0; j<b.size(); ++j){
	    if(a[i] == b[j] && i == j)
	        ++hit;
	    else if(a[i] == b[j] && i != j)
	        ++blow;
	}
    }

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

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a[5],b[5];
	int ssr,sr;
	while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
		ssr=0;
		sr=0;
		fu(0,4){
			if(a[i]==b[i]){
				ssr++;
				a[i]=INF;
				b[i]=INF;
			}
		}
		fu(0,4){
			if(b[i]!=INF){
				for(int r=0;r<4;r++){
					if(b[i]==a[r]) sr++;
				}
			}
		}
		cout<<ssr<<" "<<sr<<endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	int a[4], b[4];
	while (scanf("%d %d %d %d %d %d %d %d",
		a, a+1, a+2, a+3, b, b+1, b+2, b+3) != EOF)
	{
		set<int> included;
		for (int i = 0; i < 4; ++i)
			included.insert(a[i]);
		
		int hit, blow;
		hit = blow = 0;
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i])
				++hit;
			else if (included.count(b[i]) > 0)
				++blow;
		}
		printf("%d %d\n", hit, blow);
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

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