Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		_a, _ := strconv.Atoi(buf[0])
		_b, _ := strconv.Atoi(buf[1])
		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 <string>

using namespace std;

int main(void){

  string taro,hanako;
  while( cin >> taro >> hanako ){
    if( taro == hanako && taro == "0" )break;

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

  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


int main() {
	int r, a;
	while (cin >> r >> a && r > 0 && a > 0) {
		vi d(4, 0), e(4, 0), n(10, 0);
		rep(i, 4) {
			d[i] = r % 10;
			e[i] = a % 10;
			n[r % 10]++;
			r /= 10;
			a /= 10;
		}
		int b = 0, h = 0;
		rep(i, 4) {
			if (d[i] == e[i])b++;
			else if (n[e[i]] > 0)h++;
		}
		cout << b << " " << e << endl;
	}
}

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

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())

int main(void){
  string a,b;
  while(cin>>a>>b){
    if(a=="0")break;
    int hit=0;
    int 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<string>
using namespace std;
int main(){
	string a,b;
	while(cin>>a>>b,a!="0"||b!="0"){
		int hit=0,brow=0;
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
			if(i==j)continue;
			if(a[i]==b[j])brow++;
		}
	}
		for(int i=0;i<4;i++)if(a[i]==b[i])hit++;
		cout<<hit<<" "<<brow<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main(){
	while(1){
		int a,b;
		std::cin>>a>>b;
		if(a==0&&b==0)break;
		std::vector<int> vec(4);
		std::vector<int> vec2(4);
		int n=1000;
		for(int i=0;i<4;i++){
			int x=a/n;
			int y=b/n;
			vec[i]=x;
			vec2[i]=y;
			x*=n;
			y*=n;
			a-=x;
			b-=y;
			n/=10;
		}
			int c=0,d=0;
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(vec[i]==vec2[j]){
					if(i==j)c++;
					else d++;
				}
			}
		}

		std::cout<<c<<" "<<d<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <deque>

using namespace std;

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

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int main() {
	string r, a;
	while (cin >> r >> a, r != "0" || a != "0") {
		int hit = 0, blow = 0;
		
		bool done[10] = {};
		REP(i, 4) done[r[i]-'0'] = true;
		REP(i, 4) {
			if (r[i] == a[i]) hit++;
			else if (done[a[i]-'0']) blow++;
		}
		
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

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

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

using namespace std;
string r, a;

void solve() {
    int hit = 0;
    int blow = 0;
    rep(i, 4) {
        if (r[i] == a[i]) hit++;
    }
    rep(i, 4) rep(j, 4) {
        if (i != j && r[i] == a[j]) blow++;
    }
    cout << hit << " " << blow << endl;
}

int main() {
    while (cin >> r >> a) {
        if (r == "0" && a == "0") break;
        solve();
    }
}