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<stdio.h>
 
int main(void){
	
	int a[5],b[5];
	int i,j,hit,brrow,x,z;
	double stoped;
	
	
	//while(scanf("%lf%lf",&x,&z)!=EOF){
		
		x=0,z=0;
		hit=0,brrow=0;
	
		for(i=0;i<4;i++){
			scanf("%d",&x);
			a[i]=x;
		}

		for(i=0;i<4;i++){
			scanf("%d",&z);
			b[i]=z;
		}

		for(i=0;i<4;i++){		//hit
			if(a[i]==b[i]){
				hit++;
			}
		}
	
		for(i=0;i<4;i++){		//brrow
			for(j=0;j<4;j++){
				if(a[i]==b[j] && i!=j){
					brrow++;
				}
			}
		}	
		printf("%d %d\n",hit,brrow);
	//}
	return 0;
}

C++: #include<iostream>

int main(){
int a[4],b[4],i,j,H,B;
	while(std::cin>>a[0]){
		for(i=1;i<4;i++){
			std::cin>>a[i];
		}
		for(j=0;j<4;j++){
			std::cin>>b[j];
		}
		H=0;
		B=0;
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j]){
					if(i==j){
						H++;
					}
					else{
						B++;
					}
				}
			}
		}
		std::cout<< H << " " << B <<std::endl;
	}
return 0;
}

C++: #include <cstdio>
 
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])){
    int c=0,d=0;
    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++)
    if(a[i]==b[j])
      i==j?c++:d++;
    printf("%d %d\n",c,d);
  }
}

C++: #include <iostream>
int main()
{

	while (1) {
		int a[4], b[4];
		int eat = 0, bite = 0;
		for (int i = 0; i < 4; i++) {
			std::cin >> a[i];
		}
		for (int i = 0; i < 4; i++) {
			std::cin >> b[i];
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j&&a[i] == b[j]) {
					eat++;
				}
				else if (a[i] == b[j]) {
					bite++;
				}
			}
		}
		std::cout << eat << " " << bite << std::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 = 0, blow = 0;
    
    while(cin >> a[0] >> a[1] >> a[2] >> a[3])
    {
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        
        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<bits/stdc++.h>
using namespace std;

int p[4],q[4];
int main(){
    while(cin>>p[0]){
        for(int i=1;i<4;i++)cin>>p[i];
        for(int i=0;i<4;i++)cin>>q[i];

        int h=0,b=0;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                if(p[i]==q[j]){
                    if(i==j)h++;
                    else b++;
                }
            }
        }
        cout<<h<<" "<<b<<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<algorithm>
#include<vector>
using namespace std;

int main(){
  while(cin){
	int input,hit=0;
	vector<int> a,b,c,d;
	for(int i=0;i<8;++i) {
	  cin >> input;
	  a.push_back(input);
	}
	for(int i=0;i<4;++i){
	  if(a[i] == a[i+4]){
		b.push_back(a[i]);
		hit++;
	  }
	}
	set_intersection(a.begin(),a.begin()+4,a.begin()+5,a.end()+8,back_inserter(c));
	set_difference(c.begin(),c.end(),b.begin(),b.end(),back_inserter(d));	
	cout << hit << ' ' << d.size() << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
  int a[4],b[4];
  int hit,blow;
  while(cin >> a[0]){
    for(int i=1;i<4;i++)cin >> a[i];
    for(int i=0;i<4;i++)cin >> b[i];
    hit = blow = 0;
    for(int i=0;i<4;i++){
      if(a[i] == b[i])hit++;
      for(int j=i+1;j<4;j++){
	if(a[i] == b[j])blow++;
      }
    }
    cout << hit << ' ' << blow << endl;
  }
}

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

int main(){
	int A[4];
	int B[4];
	int hit;
	int blow;
	while(cin >> A[0] >> A[1] >> A[2] >> A[3]){
		hit = 0;
		blow = 0;
		cin >> B[0] >> B[1] >> B[2] >> B[3];
		for(int i=0;i<4;i++){
			if(A[i] == B[i]){
				hit += 1;
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i != j && A[i] == B[j]){
					blow += 1;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

int main() {
    int s;
    while (cin >> s) {
        int a[4];
        int b[4];
        a[0] = s;
        REP(i,3) cin >> a[i+1];
        REP(i,4) cin >> b[i];
        
        int hit = 0;
        REP(i,4) {
            if (a[i] == b[i]) hit++;
        }
        
        int blow = 0;
        REP(i,4) {
            if (find(begin(a), end(a), b[i]) != end(a)) {
                if (b[i] != a[i]) blow++;
            }
        }
        
        cout << hit << " " << blow << endl;
    }
    return 0;
}

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

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

    while(1){
        int hit = 0;
        int 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;
}