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 <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();
    }
}