Go: package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		a := strings.Split(buf[0], "")
		b := strings.Split(buf[1], "")
		if a == 0 && b == 0 {
			break
		}
		hit := 0
		blow := 0
		for i, av := range a {
			for j, bv := range b {
				if i == j && av == bv {
					hit++
				}
				if i != j && av == bv {
					blow++
				}
			}
		}
		fmt.Println(hit, blow)
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int hit,brow;
    char a[5],b[5];
    for(;;){
        hit=0,brow=0;
        cin>>a>>b;
        if(a[0]=='0'&&a[1]=='\0'){
            break;
        }
        for(int i=0;i<3;i++){
            for(int j=i+1;j<4;j++){
                if(a[i]==b[j]){
                    brow++;
                }
                if(b[i]==a[j]){
                    brow++;
                }
            }
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i]){
                hit++;
            }
        }
        cout<<hit<<" "<<brow<<endl;
    }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	string s, t;
	while (cin >> s >> t, t != "0") {
		int hit = 0, blow = 0;
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (i == j) {
					if (s[i] == t[j])hit++;
				}
				else {
					if (s[i] == t[j])blow++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include<iostream>
int main(){int f[2],i,j;std::string r,a;while(std::cin>>r>>a,r!="0"&&a!="0"){for(f[0]=f[1]=i=0;i<4;i++)for(j=4;j-->0;)if(a[i]==r[j])f[i!=j]++;printf("%d %d\n",f[0],f[1]);}}

C++: 
#include<iostream>
int main(){
  int f[2],i,j;
  std::string r,a;
  while(std::cin>>r>>a,r!="0"&&a!="0"){
    for(f[0]=f[1]=i=0;i<4;i++)for(j=4;j-->0;)if(a[i]==r[j])f[i!=j]++;
    std::cout<<f[0]<<" "<<f[1]<<"\n";
  }
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define EPS 1e-8
#define DEB 1


int main(){
	char in1[5],in2[5];
	while(scanf("%s %s",in1,in2),strcmp(in1,"0")|strcmp(in2,"0")){
		int hit = 0;
		int brow = 0;
		rep(i,4)if( in1[i]==in2[i] )hit++;
		rep(i,4)rep(j,4)if( i!=j )if( in1[i]==in2[j] )brow++;
		printf("%d %d\n",hit,brow);
	}
	return 0;
}

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

int main(){
  string x;
  string y;
  while(cin >> x >> y,x!="0"){
    int hit = 0;
    int blw = 0;

    for(int i=0; i<4; ++i){
      for(int j=0; j<4; ++j){
	if(x[i]==y[j]){
	  if(i==j){
	    ++hit;
	  }else if(i!=j){
	    ++blw;
	  }
	}
      }
    }

    cout << hit << " " << blw << endl;
  }
  return 0;
}

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

int main(){
 
 char qwe[6],ans[6];

 int hit,blow;

 cin >> qwe >> ans;
 
 while(hit == 4){
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;

 }

 return 0;
}

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

int main(){
int h,b;
char r[5];
char a[5];
 cin >> r >> a;
while(r[0]!=0&&r[1]!='\0'&&a[0]!=0&&a[1]!='\0'){
 h=0;b=0;
 for(int i=0;i<4;i++){
 	 if(r[i]==a[i]){
           h++;
	 }
 }
 for(int i=0;i<4;i++){
  for(int j=0;j<4;j++){
   if(r[i]==a[j]){
      b++;
    }
  }
}
 b=b-h;
 cout << h << ' ' << b << endl;
 cin >> r >> a;
}
return 0;
}

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

int main() {

  string a,b;

  while(1) {

    a.clear();
    b.clear();
    cin >> a >> b;
    if(a.size() == 1 && b.size() == 1) break;

    int hit = 0,br = 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] && i != j) {
	  br++;
	}
      }
    
    cout << hit <<" "<< br << endl;
    
  }

  return 0;

}

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

int main(){
	string taroNomber;
	string hanakoNomber;
	int hitCount = 0;
	int blowCount = 0;
	while(true){
		cin >> taroNomber >> hanakoNomber;
		if(taroNomber=="0" && hanakoNomber=="0"){
			break;
		}
		hitCount = 0;
		blowCount = 0;
		int taroSize = taroNomber.size();
		int hanakoSize = hanakoNomber.size();
		for(int i=0;i<taroSize;i++){
			for(int j=0;j<hanakoSize;j++){
				if(taroNomber[i] == hanakoNomber[j]){
					if(i == j){
						hitCount++;
					}else{
						blowCount++;
					}
				}
			}
		}
		cout << hitCount << blowCount << '\n';
	}

	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
int h;
int b;
char r[10],a[10];
cin>>r>>a;
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(r[i]==a[j]){
b++;
if(i==j){
h++;
}
}
}
}
b=b-h;
cout<<h<<' '<<b<<'\n';
return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string s,t;
	int x,y;
	while(cin>>s>>t,s.size()!=1){
		x=0;y=0;
		for(int i=0;i<4;i++)
		for(int j=0;j<4;j++){
			if(s[i]==t[j]){
				if(i==j)
					x++;
				else y++;
			}
		}
		cout<<x<<' '<<y<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  string str,str1;
  while(1){
    int HIT=0,BLOW=0;
    cin>>str>>str1;
    if(str.size()!=4)break;
    for(int i=0;i<4;i++)
      for(int j=0;j<4;j++)
	if(str[i]==str1[j])
	  if(i==j)HIT++;
	  else BLOW++;
    cout<<HIT<<' '<<BLOW<<endl;
  } 
 return 0;
}

C++: #include <cstdio>
#include <cstring>

char a[10],b[10];
int main(){
    for(;;){
        scanf("%s %s\n",a,b);
        if(strlen(a)==1&&strlen(b)==1) break;
        int h=0,bl=0;
        for(int i=0;i<4;i++){
            if(a[i]==b[i]) h++;
        }
        for(int i=0;i<10;i++){
            bool isa=false,isb=false;
            for(int j=0;j<4;j++){
                if(a[j]=='0'+i) isa=true;
                if(b[j]=='0'+i) isb=true;
            }
            if(isa&&isb) bl++;
        }
        bl-=h;
        printf("%d %d\n",h,bl);
    }
}

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

int main()
{
 char stra[10], strb[10];
 int hit,bro;
 cin>>stra>>strb;

 for(int i=0;i<4;i++){
  if(stra[i]==strb[i]){
	hit++;}
  for(int j=0;j<4;j++){
	if(stra[i]==strb[j])
	 bro++;}
 }

bro=bro-hit;

cout<<hit<<' '<<bro<<'\n';

return 0;
}

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

int main(){
	char a[5], b[5];
	int c, d;
	while (true) {
		c = d = 0;
		scanf("%s %s", a, b);
		if (a[1] == '\0') break;
		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);
	}

	return 0;
}

C++: #include<iostream>
int main(){int h,b,i,j;std::string r,a;while(std::cin>>r>>a,r!="0"&&a!="0"){h=b=i=0;for(;i<4;i++)for(j=4;j-->0;)if(a[i]==r[j])i==j?h++:b++;printf("%d %d\n",h,b);}}

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

int main()
{
  int f[2];
  int i,j;
  string r,a;
  while(cin>>r>>a,r!="0"&&a!="0"){
    f[0]=f[1]=0;
    for(i=0;i<4;i++)
      for(j=0;j<4;j++)
	if(a[i]==r[j]) f[i!=j]++;
    cout<<f[0]<<" "<<f[1]<<endl;
  }
  return 0;
}