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>

int hit(std::vector<int> a, std::vector<int> b){
    int hit_count = 0;
    for(int i = 0; i < 4; ++i){
        if(a.at(i) == b.at(i)){
            hit_count += 1;
        }
    }
    return hit_count;
}

int same_number(std::vector<int> a, std::vector<int> b){
    int same_count = 0;
    for(int i = 0; i < 4; ++i){
        for(int j = 0; j < 4; ++j){
            if(a.at(i) == b.at(j)){
                same_count += 1;
            }
        }
    }
    return same_count;
}

int main(){
    std::vector<int> a_set, b_set;
    int a[4], b[4];
    while(std::cin >> a[0] >> a[1] >> a[2] >> a[3]){
        if(a[0] == -1 or a[1] == -1 or a[2] == -1 or a[3] == -1)  break;
        for(int i = 0; i < 4; ++i){
            a_set.push_back(a[i]);
        }
        std::cin >> b[0] >> b[1] >> b[2] >> b[3];
        if(b[0] == -1 or b[1] == -1 or b[2] == -1 or b[3] == -1)  break;
        for(int i = 0; i < 4; ++i){
            b_set.push_back(b[i]);
        }
        std::cout << hit(a_set, b_set) << " " << same_number(a_set, b_set) - hit(a_set, b_set) << std::endl;
        a_set.clear();
        b_set.clear();
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
    int a[4];
    int c[4];
    while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>c[0]>>c[1]>>c[2]>>c[3]){
        int h=0,b=0;
        for(int i=0;i<4;i++){
            if(a[i]==c[i])
                h++;
            else{
                for(int j=0;j<4;j++){
                    if(a[i]==c[j]){
                        b++;
                        break;
                    }
                }
            }
        }
        cout<<h<<" "<<b<<endl;
    }
    return 0;
}

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

int main(){
	int a[5],b[5],hi,bl;
	while(cin>>a[1]){
		cin>>a[2]>>a[3]>>a[4]>>b[1]>>b[2]>>b[3]>>b[4];
		hi=bl=0;
		for(int i=1;i<=4;i++){
			for(int j=1;j<=4;j++){
				if(a[i]==b[j]){
					if(i==j) hi++;
					else bl++;
				}
			}
		}
		cout<<hi<<" "<<bl<<endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

int main(void){
	int hit, blow, a[4], b[4], i, j;
	while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]) != EOF){
		hit = blow = 0;
		for(i = 0;i < 4;i++){
			scanf("%d",&b[i]);
		}
		for(i = 0;i < 4;i++){
			for(j = 0;j < 4;j++){
				if(a[i] == b[j] && i == j){
					hit++;
				}else if(a[i] == b[j]){
					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]) {
    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[i] == b) {
	  if (i == j) {
	    hit++;
	  }
	  else {
	    blow++;
	  }
	}
      }
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

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

using namespace std;

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

	for(int i=0; i<4; i++){
		cin >> a[i];
	}
	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 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(b[i]==a[j]){
	  blow++;
	}
      }
    }
    blow-=hit;
    cout<<hit<<" "<<blow<<"\n";
  }
  return 0;
}

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

int main()
{
cout<<"Accepted"<<endl;
return 0;
}

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

int main(void)
{
	int n, hit = 0 , blow = 0;
	int num1[4], num2[4];

	for(int f1 = 0; f1 < 4; f1++)
	{
		scanf("%d", &num1[f1]);
	}
	for(int f1 = 0; f1 < 4; f1++)
	{
		scanf("%d", &num2[f1]);
	}
	for(int f1 = 0; f1 < 4; f1++)
	{
		if(num1[f1] == num2[f1])
		{
			hit++;
		}
		else
		{
			for(int f2 = 0; f2 < 4; f2++)
			{
				if(num1[f1] == num2[f2])
				{
					blow++;
					break;
				}
			}
		}
	}
	printf("%d %d\n", hit, blow);
	return 0;
}

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

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

  while(cin>>a[0]>>a[1]>>a[2]>>a[3]){
    cin>>b[0]>>b[1]>>b[2]>>b[3];
    hit = 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(a[i] == b[j])
	  blow++;

    blow -= hit;

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


  return 0;
}

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

int main(void){
  int a[4],b[4],Hit,Blow;


  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 = 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>
#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){ 

  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>
#include <array>

int main(void){
	std::array <int, 4> ansA;
	std::array <int, 4> ansB;

	while(std::cin >> ansA[0] >> ansA[1] >> ansA[2] >> ansA[3] >> ansB[0] >> ansB[1] >> ansB[2] >> ansB[3]){
		int hit = 0; //count hit
		int blow = 0; //count blow

		for(size_t i = 0; i < ansA.size(); ++i){ //judgment hit and blow
			for(size_t j = 0; j < ansB.size(); ++j){
				if(ansA[i] == ansB[j] && i == j){
					++hit;
				}else if(ansA[i] == ansB[j] && i != j){
					++blow;
				}
			}
		}

		std::cout << hit << " " << blow << std::endl; //output result
	}

	return 0;
}

C++: #include <iostream>
#include <set>
using namespace std;
int main() {
	string a, b;
	while (getline(cin, a) && getline(cin, b)) {
		set<int> aa, bb;
		int hit = 0;
		int blow = 0;
		for (int i = 0; i != a.size()+1; i += 2) {
			if (a[i] == b[i]) {
				++hit;
			}
			else {
				aa.insert(a[i]-'0');
				bb.insert(b[i]-'0');
			}
		}
		for (int i =1; i <= 9; ++i) {
			if (aa.count(i) && bb.count(i)) {
				cout << i << endl;
				++blow;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}