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[4], b[4];

    while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
        int 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<stdio.h>

int main()
{
int p[4]={};
int q[4]={};
int x,H,B;
H=0;B=0;
for(int i=0;i<4;i++)
{scanf("%d",&x);p[i]=x;}
for(int i=0;i<4;i++)
{scanf("%d",&x);q[i]=x;}
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{if(p[i]==q[j]){
	if(i==j)H++;
    else if(i!=j)B++;
}}
printf("%d %d\n",H,B);
return 0;
}

C++: #include <iostream>

using namespace std;

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 hit = 0;
    int blow = 0;

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

    return 0;
}

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

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

int main(){
    int a[5];

    while(cin >>a[1]>>a[2]>>a[3]>>a[4]){
        int b[5], hit=0, blow=0;
        cin >>b[1]>>b[2]>>b[3]>>b[4];
        for(int i=1; i<6; i++){
            for(int j=1; j<6; j++){
                if(a[i] == b[j]){
                    blow++;
                    if(i == j){
                        blow--;
                        hit++;
                    }
                }
            }
        }
        cout << hit << ' ' << blow << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int main(){
	int a[4], b[4];
	while(scanf("%d %d %d %d\n%d %d %d %d\n", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3])!=EOF){
		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);
	}
	return 0;
}

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

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

  for(i=0; i<10; i++) appear[i]=0;
  while(cin>>a[0]){
    hit=0; blow=0;
    for(i=1; i<4; i++){
      cin>>a[i];
      appear[a[i]]++;
    }
    for(i=0; i<4; i++) cin>>b[i];

    for(i=0; i<4; i++){
      if(a[i]==b[i]) hit++;
      blow+=appear[b[i]];
    }

    for(i=1; i<4; i++) appear[a[i]]=0;
    printf("%d %d\n", hit, blow);
  }

  return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

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 num[10]; CLR(num);
    int hit = 0, blow = 0;
    FOR(i,0,4) {
      if(a[i] == b[i]) hit++;
      num[a[i]]++;
      num[b[i]]++;
    }
    cout << hit << " " << blow - hit << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
bool input (std::vector<int> & v)
{
	for (std::vector<int>::size_type i = 0; i < v.size(); i++) {
		if(!(std::cin >> v[i])) return false;
	}
	return true;
}
void get_hit_blow(int & hit, int & blow, std::vector<int> a, std::vector<int> b)
{
	for (int i = 0; i < 4; i++) {
		if (a[i] == b[i]) ++hit;
		for (int j = 0; j < 4; j++) {
			if (a[i] == b[j]) ++blow;
		}
	}
	blow -= hit;
}
int main()
{
	std::vector<int> a(4), b(4);
	while (input(a) && input(b)) {
		int hit = 0, blow = 0;
		get_hit_blow(hit, blow, a, b);
		std::cout << hit << ' ' << blow << std::endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    int a,b,c,d;
    while(cin>>a>>b>>c>>d){


	cin>>a>>b>>c>>d;
	int w,x,y,z;
	int hit=0,blow=0;
	cin>>w>>x>>y>>z;
	if(w==a)hit++;
	else if(w==b||w==c||w==d)blow++;
	if(x==b)hit++;
	else if(x==a||x==c||x==d)blow++;
	if(y==c)hit++;
	else if(y==b||y==a||y==d)blow++;
	if(z==d)hit++;
	else if(z==b||z==c||z==a)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>
using namespace std;

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

  int h=0, bl=0;

  while( cin>>a[0] ){
    for( int i=1;i<4;i++ )
      cin >> a[i];
    for( int j=0;j<4;j++ )
      cin >> b[j];
    
    h=0; bl=0;
    for( int i=0;i<4;i++ )
      if( a[i]==b[i] )
	h++;
    for( int i=0;i<4;i++ )
      for( int j=0;j<4;j++ )
	if( a[i]==b[j] && i!=j )
	  bl++;
    cout << h << " " << bl << endl;
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
int main (){
      for(int i=0;i<2;i++){
            int tmp,x=0,y=0,d[4];
            for(int j=0;j<4;j++)cin>>d[j];
            for(int j=0;j<4;j++){
                  cin>>tmp;
                  if(d[j]==tmp){x++;continue;}
                  for(int k=0;k<4;k++)if(d[k]==tmp){y++;break;}
            }
            cout<<x<<' '<<y<<endl;
      }
}