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<vector>

bool CheckArray(const std::vector<int>& v, const int& x)
{
	bool flg=0;

	for(size_t i=0; i<v.size(); ++i)
	{
		if(v[i]==x)
		{
			flg=1;
		}
	}

	return flg;
}

int main()
{
	const int Item =4;//ヒットアンドブローで遊ぶ数字の数

	std::vector<int> a;

	int temp=0, cHit=0, cBlow=0;

	while(1)
	{
		if(std::cin.eof())
		{
			break;
		}

		for(int i=0; i<Item; ++i)
		{
			std::cin >> temp;

			a.push_back(temp);
		}

		for(int i=0; i<Item; ++i)
		{
			std::cin >> temp;

			if(temp==a[i])
			{
				++cHit;//Hitのカウント
			}

			if(CheckArray(a,temp))
			{
				++cBlow;//tempがa[]のどれかと一致（Hit+Blow）
			}
		}

		cBlow -= cHit;

		std::cout << cHit << ' ' << cBlow << '\n';

		a.clear();

		cHit=0, cBlow=0;
	}
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int a[4],b[4],hit = 0,blow = 0;
	while(1)
	{
		for(int i = 0;i<4;i++)
		{
			if(scanf("%d",&a[i]) == EOF) goto kitune;
		}
		for(int i = 0;i < 4;i++)
		{
			scanf("%d",&b[i]);
		}

		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;
			}
		}
		printf("%d %d\n",hit,blow);
		hit = 0;
		blow = 0;
	}
	kitune:;
	return 0;
}

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

int main() {
	vector<int> a(4), b(4);
	while(!cin.eof()){
		for( int i=0; i<4; ++i ) cin >> a[i];
		for( int i=0; i<4; ++i ) cin >> b[i];
		
		int hit = 0, blow = 0;
		for( int i=0; i<4; ++i ){
			if( a[i] == b[i] ){
				++hit;
			}else{
				for( int j=0; 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=0;
	int blow=0;
	int m, n;

	while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
	for(int i=0; i<4; i++){
		cin >> b[i];
	}
	for(m=0; m<4; m++){
		for(n=0; n<4; n++){
			if(a[m] == b[n] && m == n){
				hit = hit + 1;
			}
			else if(a[m] == b[n]){
				blow = blow + 1;
			}
		}
	}
		
	cout << hit << " " << blow << endl;
}
}

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

int a[4], b[4];

void solve(void)
{
    int hit = 0;
    for (int i = 0; i < 4; i++) {
        if (a[i] == b[i]) {
            a[i] = 0;
            hit++;
        }
    }

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

    cout << hit << ' ' << blow << endl;
}

int main()
{
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]
               >> b[0] >> b[1] >> b[2] >> b[3]) {
        solve();
    }
    return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int h=0,n=0;
	int a[3],b[3],dat=1;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		for(int j=0;j<4;j++){
			cin>>dat;
			b[j]=dat;
	}
	for(int k=0;k<4;k++){
		for(int o=0;o<4;o++){
			if(a[k]==b[k]){
				h++;
			}
			if(a[k]!=b[k] && a[k]==b[o]){
				n++;
			}
		}
	}
	cout<<h<<" "<<n<<endl;
	}
	return 0;
}

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

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

C++: #include <bits/stdc++.h>

using namespace std;

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

C++: #include<iostream>
using namespace std;
int main()
{
	int a[4];
	int b[4];
	int h=0, br=0;
	while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
		h = 0, br = 0;
		for (int i = 0; i < 4; i++){
			cin >> b[i];
		}
		for (int i = 0; i < 4; i++){
			if (a[i] == b[i]){
				h++;
				a[i] = -1;
				b[i] = -1;
			}
		}
		for (int i = 0; i < 4; i++){
			for (int i2 = 0; i2 < 4; i2++){
				if (a[i] == b[i2]&&b[i2]!=-1){
					br++;
				}
			}
		}
		cout << h << " " << br << endl;
	}
}

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

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

                }
            }
        }
        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>
#include <vector>
#include <set>

using namespace std;

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