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++: //
//  kadai0025.cpp
//  Hit and Blow
//  ????????????
//
//  Created by ???????¶???? on 2016/05/29.
//
#include <iostream>

int main(){
    int a_num[4];
    int b_num[4];
    
    while (true) {
        
        // input a's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> a_num[i]) ){
                return 0;
            }
        }
        // input b's number.
        for (int i=0; i<4; ++i) {
            if(! (std::cin >> b_num[i]) ){
                return 0;
            }
        }
        
        // count hit.
        int hit=0;
        for (int i=0; i<4; ++i) {
            if (a_num[i] == b_num[i]) {
                ++hit;
            }
        }
        std::cout << hit << " ";
        
        // count blow.
        int blow=0;
        for (int i=0; i<4; ++i) {
            for (int j=0; j<4; ++j) {
                if (i==j) {
                    break;
                }
                if (b_num[i] == a_num[j]) {
                    ++blow;
                    break;
                }
            }
        }
        std::cout << blow << std::endl;
        
    }
    return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
    int a[5],b[5],t1,t2;
	while(scanf("%d%d%d%d",a+1,a+2,a+3,a+4)!=EOF)
	{
		scanf("%d%d%d%d",b+1,b+2,b+3,b+4);
		t1=t2=0;
		for (int i=1;i<=4;i++)
		{
			if (a[i]==b[i]) t1++;
			for (int j=1;j<=4;j++) if (i!=j&&a[i]==b[j]) t2++;
		}
		cout<<t1<<" "<<t2<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

#define rep(i, n) for(int i=0; i<(int)(n); i++)

int main()
{
	int a[4], b[4];
	while(scanf("%d%d%d%d%d%d%d%d", a, a+1, a+2, a+3, b, b+1, b+2, b+3)!=EOF) {
		int hit=0, blow=0;
		rep(i, 4) rep(j, 4) if(a[i]==b[j]) {
			if(i==j) hit++;
			else blow++;
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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]))
	{
		bool v[4];
		int ch=0,cb=0;
		for(int i=0;i<4;i++)v[i]=true;
		for(int i=0;i<4;i++)
		{
			if(a[i]==b[i])
			{
				v[i]=false;
				ch++;
			}
		}
		for(int i=0;i<4;i++)
		{
			for(int j=0;v[i]&&j<4;j++)
			{
				if(a[i]==b[j])
				{
					cb++;
				}
			}
		}
		cout<<ch<<" "<<cb<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int blow,hit;
	int a[4];
	int b[4];
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 j=i+1;j<4;j++)
		{
			if(a[i]==b[j])
			{
			blow++;
			}
		}
	}
	cout<<hit<<" "<<blow<<endl;
}
return 0;
}

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

int main(){

  std::stack<int> st;

  int N = 0;
  int a;

  while(N <= 100 && std::cin >> a){
    if(a != 0){
      st.push(a);
    }
    else{
      std::cout << st.top() << std::endl;
      st.pop();
	}
    ++N;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 50;
    for(int i = 0;i < 50;i++){
        cin >> a[0][i] >> a[1][i] >> a[2][i] >> a[3][i] 
            >> b[0][i] >> b[1][i] >> b[2][i] >> b[3][i] ;
        /*int t = 0;
        for(int j = 0;j < 4;j++){
            if(a[j][i] != 0){
                t = 1;
                j = 4;
            }
            if(b[j][i] != 0){
                t = 1;
                j = 4;
            }
        }
        if (t == 0){
            n = i;
            i = 50;
        }*/
    } 
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}

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


using namespace std;

int main(){
  while(true){
    vector<int> a, b;
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      a.push_back(tmp);
    }
    for(int i=0;i<4;i++){
      int tmp;
      cin >> tmp;
      b.push_back(tmp);
    }

    for(int i=0;i<a.size();i++){
      //      cout << a[i] << endl;
    }
    for(int i=0;i<b.size();i++){
      //      cout << b[i] << endl;
    }

    int hit=0;
    int blow=0;
    for(int i=0;i<a.size();i++){
      for(int j=0;j<b.size();j++){
	if(a[i]==b[j]){
	  if(i==j){
	    hit++;
	  }else{
	    blow++;
	  }
	}
      }
    }

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

C++: #include<stdio.h>
int main()
{
	int a[4],b[4],hi,bl;
	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])==EOF)){
		hi=0;
		bl=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i]){
				hi++;
			}else if(a[i]==b[0]||a[i]==b[1]||a[i]==b[2]||a[i]==b[3]){
				bl++;
			}
		}
		printf("%d %d\n",hi,bl);
	}
	return 0;
}

C++: #include<stdio.h>
main(){
  int a[5],b[5],coh=0,cob=0,i,j;
  
  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]);
  
  for(i=0;i<4;i++){

    if(a[i]==b[i]) coh++;

    for(j=0;j<4;j++){
	if(j!=i){

	  if(a[i]==b[j]) cob++;

	}
    }
  }
  printf("%d %d\n",coh,cob);
  
  return 0;
}

C++: #include <iostream>

int main(void)
{
	while(true)
	{
		int a[10]={0},b[10]={0},n;
		for(int i=1; i<=4; i++)
		{
			if(!(std::cin >> n))
				return 0;
			a[n]=i;
		}
		for(int i=1; i<=4; i++)
		{
			if(!(std::cin >> n))
				return 0;
			b[n]=i;
		}

		int hit=0,blow=0;
		for(int i=0; i<=9; i++){
			if(b[i] == 0)
				continue;
			if(a[i] == b[i])
				hit++;
			else if(a[i]!=0)
				blow++;
		}
		std::cout << hit << " " << blow << std::endl;
	}
}