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>
using namespace std;
int main() {
	string a, b;
	while (cin>>a>>b) {
		if (a=="0"&&b=="0") break;
		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>
#include<string>
#include<vector>
using namespace std;
int main(){
  string a,b;
  int hit, blow;
  bool flag[4];
  while(cin >> a >> b){
    if(a[0] == '0' && b[0] == '0') return 0;
    for(int i=0; i<4; i++){
    }

    hit = 0; 
    blow = 0;
    for(int i=0; i<4; i++)
      flag[i] = false;

    for(int i=0; i<4; i++){
	if(a[i] == b[i]){
	  hit++;
	  flag[i] = true;
	}
	for(int j=0; j<4; j++){
	  if( a[i] == b[j] &&  flag[i] != true){
	    blow++;
	  }
	}
    }
    cout << hit << " " << blow << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  string a, b;
  while(cin >> a >> b, a != "0") {
    int hi = 0, br = 0;
    REP(i,4) {
      REP(j,4) {
        if (a[i] == b[j]) {
          if (i==j) hi++;
          else br++;
        }
      }
    }
    cout << hi << " " << br << endl;
  }
}

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

int hit(string a,string b){
  int res = 0;
  for(int i=0;i<4;i++){
    if(a[i] == b[i]) res++;
  }
  return res;
}

int blow(string a,string b){
  int res = 0;
  for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
      if(i != j && a[i] == b[j]){
        res++;
        break;
      }
    }
  }
  return res;
}

int main(void){
  string a,b;

  while(cin>>a>>b, a!="0"){
    cout<<hit(a,b)<<" "<<blow(a,b)<<endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std ;

main(){
	int r,a ;
	while( cin >> r >> a ){
		if( !r && !a ) break ;
		
		int k=1000,p[4],q[4] ;
		for( int i=0 ; i<4 ; i++ ){
			p[i] = r/k ;
			q[i] = a/k ;
			r -= p[i]*k ;
			a -= q[i]*k ;
			k /= 10 ;
		}
		
		int cnt=0 , cnt2=0 ;
		for( int i=0 ; i<4 ; i++ ){
			if( p[i] == q[i] ){
				cnt++ ;
				continue ;
			}
			for( int j=0 ; j<4 ; j++ ){
				if( p[i] == q[j] ){
					cnt2++;
					continue ;
				}
			}
		}
		
		cout << cnt << " " << cnt2 << endl ;
	}
}

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

int a[4],b[4];
void search()
{
	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])
				blow++;
		}
	}
	cout << hit << ' ' << blow << endl;
}

int main()
{
	int m,n;
	while(cin >> m && cin >> n){
		if(m==0&&n==0)
			break;
		int j=10;
		for(int i=3;i>=0;i--){
			a[i] = m%j;
			b[i] = n%j;
			m/=j;
			n/=j;
		}
		search();
	}
	return 0;
}

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

using namespace std;

int main()
{
  while (1) {
    string r, a;

    cin >> r >> a;
    if (r == "0" && a == "0") break;
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        if (r[i] == a[j] && i == j) hit++;
        if (r[i] == a[j] && i != j) blow++;
      }
    }
    cout << hit << " " << blow << endl;
  }
}

C++: #include <stdio.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
char a[4], b[4]; int  hit, blow;
int main() {
	while (true) {
		scanf("%s %s", a, b);
		if (strlen(a) == 1 && strlen(b) == 1) break;
		hit = 0; blow = 0;
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) hit++;
			for (int j = 0; j < 4; j++) {
				if (i != j && a[i] == b[j]) {
					blow++; break;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
for(int x=0;x>=0;x++){
int h;
int b;
char r[10],a[10];
char z[2]="0";
cin>>r>>a;
if((strcmp(r,z)==0)&&(strcmp(a,z)==0)){
break;
}
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 ans,forecast;
	while(1){
		cin>>ans>>forecast;
		if(ans=="0" && forecast=="0")break;
		int hit,blow;
		hit=blow=0;
		for(int i=0 ; i<4 ; i++ ){
			for(int j=0 ; j<4 ; j++ ){
				if(ans[i]==forecast[j]){
					if(i==j)
						hit++;
					else
						blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

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

int main() {
	
	string a,b;
	int hit=0,blow=0;
	while(1){
		cin >> a >>b ;
		if(a[0]=='0' && b[0]=='0') break;
		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;
		hit=0;
		blow=0;
		
	}
	
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s, t;

int main(){
	while (cin >> s >> t){
		if (s == "0"&&t == "0")break;
		int h = 0, b = 0;
		REP(i, s.size()){
			if (s[i] == t[i])h++;
		}
		REP(i, s.size()){
			REP(j, s.size()){
				if (i == j)continue;
				if (s[i] == t[j])b++;
			}
		}
		cout << h << " " << b << endl;
	}
}

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

int main(){
int h=0,b=0;
char r[4];
char a[4];
cin >> r >> a;
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;
return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	string a, b;
	while (1) {
		cin >> a >> b;
		if (a == "0" && b == "0")break;

		int hit = 0, 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++;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}