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 a[4],b[4];
int hit, blow;

int main(){
	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
		cin >> 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++;
					if(a[i] == b[j] && i != j) blow++;
				}
		}
		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])){
		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>
#include<vector>
using namespace std;
int main(){
  vector<int> hit_anss;
  vector<int> bolor_anss;
  int nums_a[4],nums_b[4];
  int hit=0,bolor=0;
  while(cin>>nums_a[0]<<nums_a[1]<<nums_a[2]<<nums_a[3]<<nums_a[3]){
    for(int i=0;i<4;i++){
      cin>>nums_b[i];
    }
    //hit????¢????
    for(int i=0;i<4;i++){
      if(nums_a[i]==nums_b[i])hit++;
    }
    //bolor????¢????
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
        if(i==j)continue;
        if(nums_a[i]==nums_b[j]){
          bolor++;
          break;
        }
      }
    }
    hit_anss.push_back(hit);
    bolor_anss.push_back(bolor);
  }
  for(int i=0;i<hit_anss.size();i++){
    cout<<hit_anss[i]<<' '<<bolor_anss[i]<<endl;
  }
}

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>
#include<cstdio>
using namespace std;

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


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

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


}

C++: #include <iostream>

int hit(int x[],int y[]){
	int num = 0;
	for(int i = 0; i < 4; ++i){
		if(x[i] == y[i])
			++num;
	}
	return num;
}

int blow(int x[],int y[]){
	int num = 0;
	for(int i = 0; i < 4; ++i){
		for(int j = 0; j < 4;++j){
			if(x[i] == y[j])
				++num;
		}
	}
	return num - hit(x,y);
}

int checkDomain(int x[],int y[]){
	for(int i = 0; i < 4; ++i)
		if((x[i] / 10) != 0 || (y[i] / 10) != 0) return 0;
		
	return 1;
}

int checkNumber(int x[],int y[]){
	for(int i = 0; i < 4; ++i){
		for(int j = 0; j < 4; ++j){
			if(i != j && (x[i] == x[j] || y[i] == y[j])) return 0;
		}
	}
	return 1;
}

int main(){
	int a[4];
	int b[4];
	
	while(std::cin >> a[0] >> a[1] >> a[2] >> a[3] ){
		std::cin >>b[0] >> b[1] >> b[2] >> b[3];
		if(checkDomain(a,b) && checkNumber(a,b)){
					std::cout << hit(a,b) << " " << blow(a,b) << std::endl;
		}
	}
	
}

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

int main() {
  int a[4], b[4];
  while (~scanf("%d%d%d%d", &a[0], &a[1], &a[2], &a[3])) {
    scanf("%d%d%d%d", &b[0], &b[1], &b[2], &b[3]);
    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++;
        }
      }
    }
    printf("%d %d\n", hit, blow);
  }
}

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

//#define PI 3.141592653589

using namespace std;



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

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    int a[4], b[4], hit, blow;
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3])
    {
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        
        hit = blow = 0;
        rep(i,4)
        {
            if(a[i] == b[i]) hit++;
            else{
                rep(j,4){
                    if(a[i] == b[j]){
                        blow++;
                        break;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<random>
using namespace std;

int main(){

  vector<int> a(4);
  vector<int> b(4);
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){

    vector<int> n(10, 0);
    int hit = 0;
    int blow = 0;
    for(int i=0; i<4; i++){
      if( a[i] == b[i] ){
        hit++;
        n[ a[i] ]--;
      }
    }

    for(int i=0; i<4; i++){
      n[ a[i] ]++;
      n[ b[i] ]++;
    }
    for(int i=0; i<10; i++){
      if( n[i] == 2 ) blow++;
    }

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

  return 0;
}




// EOF

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

int hit(int str[],int str2[]){
  int i, j = 0;

  for(i = 0;i < 4;i++){
    if(str[i] == str2[i]){
      j++;
    }
  }

  return j;
}

int blow(int str3[],int str4[]){
  int i, j = 0;

  sort(str3, str3 + 4);
  sort(str4, str4 + 4);

  for(i = 0;i < 4;i++){
    if(str3[i] == str4[i]){
      j++;
    }
  }

  return j;
}

int main(){
  int str[4], str2[4];

  while(scanf("%d %d %d %d", &str[0], &str[1], &str[2], &str[3]) != EOF){ 

    cin >> str2[0] >> str2[1] >> str2[2] >> str2[3];

  int hit_var = hit(str, str2);
  int blow_var = blow(str, str2);

  cout << hit_var << " " << blow_var - hit_var << 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]){
		int hit = 0, blow = 0;
		for(int i = 0 ; i < 4; i++){
			cin >> b[i];	
			if(a[i] == b[i]){
				hit++;
				a[i] = -1;
			}
			else{
				for(int j = 0;j < 4; j++){
					if(i != j && b[i] == a[j]) blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}