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<stdio.h>
void kansu(int,int);
int main(void)
{
	int r,a;

	while(1)	{
		scanf("%d %d",&r,&a);
		if((r==0) && (a==0)) break;
		kansu(r,a);
	}
	return 0;
}
void kansu(int r,int a)
{
	int t[4],h[4];
	int i,j;
	int hit,blow;
	t[0]=r%10;
	r=r/10;
	t[1]=r%10;
	r=r/10;
	t[2]=r%10;
	t[3]=r/10;
	h[0]=a%10;
	a=a/10;
	h[1]=a%10;
	a=a/10;
	h[2]=a%10;
	h[3]=a/10;
	
	hit=0;
	blow=0;
	for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(h[i]==t[j]){
					if(i==j){
						hit++;
					}
					else{
						blow++;
					}
				}
			}
		}
	printf("%d %d\n",hit,blow);
}

C++: #include<iostream>
#include<string>
using namespace std;
string S, T, U; int a[4], b[4], h, v;
int main() {
	while (cin >> S >> T) {
		h = 0; b = 0;
		if (S == "0") { break; }
		for (int i = 0; i < 4; i++) {
			U = S[i] + '0';
			a[i] = stoi(U) / 10;
		}
		for (int i = 0; i < 4; i++) {
			U = T[i] + '0';
			b[i] = stoi(U) / 10;
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) { h++; }
					else { v++; }
				}
			}
		}
		cout << h << ' ' << v << endl;
	}
}

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

int main(int argc, char *argv[]){
  string r, a;
  while(std::cin >> r >> a){
    if(r == "0")break;
    int n = r.size();
    map<char, int> hash;
    for (int i = 0; i < n; i++) {
      hash[r[i]] = i;
    }
    int hit = 0, blow = 0;
    for (int i = 0; i < n; i++) {
      if(a[i] == r[i]){
        hit++;
        continue;
      }
      if(hash.count(a[i]) == 1){
        blow++;
      }
    }
    std::cout << hit << " " << blow << std::endl;
  }
  return 0;
}

C++: //26
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  for(string r,a;cin>>r>>a,r!="0"&&a!="0";){
    int h=0,b=0;
    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	*((i==j)?&h:&b)+=r[i]==a[j];
      }
    }
    cout<<h<<' '<<b<<endl;
  }
  return 0;
}

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

int main() {
	char r[5],a[5];
	int n1,n2;
	int hit, blow;
	
	while (cin >> r , cin >> a) {
		if ( *r == '0' && *a == '0' )	break;

		hit = 0;
		blow = 0;

		for ( int i = 0; i < 4; i++ ) {
			if ( r[i] == a[i] ) {
				hit++;
			}
			else {
				for ( int j = 0; j < 4; j++ ) {
					if ( r [i] == a[j] ){
						blow++;
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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

int main(){
  char r[10],a[5];
  while(1){
  int hit=0,blow=0;
  cin>>r>>a;
  if(r[0]=='0'&&a[0]=='0'){
     break;
   }
  for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
        if(r[i]==a[j]){
          if(i==j){
            hit++;
          }else{
            blow++;
          }
        }
    }
  }
  cout<<hit<<" "<<blow<<"\n";
}
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	char a[5];
	char b[5];
	int hit;
	int blow;
	while (cin >> a >> b) {
		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 += 1;
					}
					else blow += 1;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

C++: #include<iostream>
int main(){int h,b,i,j;std::string r,a;while(std::cin>>r>>a,r!="0"&&a!="0"){for(h=b=i=0;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 <cstdio>
#include <cmath>


int r, a, dr[10], da[10], cnt[10];
int hit, bro;

int main(){
    while(scanf("%d %d", &r, &a)){
        if(r == 0 && a == 0) break;

        for(int i = 0; i < 10; i++){
            dr[i] = 0;
            da[i] = 0;
            cnt[i] = 0;
        }

        hit = bro = 0;
        for(int i = 3; i >= 0; i--){
            dr[i] = (int)(r / pow(10, i)) % 10;
            da[i] = (int)(a / pow(10, i)) % 10;

            if(dr[i] == da[i]) hit++;
            else{
                cnt[dr[i]]++;
                cnt[da[i]]++;
            }
        }

        for(int i = 0; i < 10; i++){
            if(cnt[i] > 1) bro++;
        }

        printf("%d %d\n", hit, bro);

    }

    return 0;
}

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

using namespace std;

int main() {
  for (;;) {
    string r, a;
    cin >> r >> a;
    if (r.length() != 4) return 0;
    int H = 0, B = 0;
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++)
        if (a[i] == r[j])
          if (i == j)
            H++;
          else
            B++;
    cout << H << ' ' << B << endl;
  }
}

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

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

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

C++: #include<stdio.h>
void main(){
	int i,j,hit,blow;
	int a,b,d;
	int aa[4],bb[4];

	while(1){
		d=1000;
		hit=0;
		blow=0;
		scanf("%d %d",&a,&b);
		if(a==0 && b==0) break;
		for(i=0;i<4;i++){
			aa[i]=a/d;
			a=a%d;
			bb[i]=b/d;
			b=b%d;
			d=d/10;
		}
		for(i=0;i<4;i++){
			if(aa[i]==bb[i]) hit++;
			for(j=0;j<4;j++){
				if(aa[i]==bb[j]) blow++;
			}
		}
		printf("%d %d\n",hit,blow-hit);
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

int main(){
	string r, a;
	while(cin >> r >> a, r!="0"||a!="0"){
		map<char, int> n;
		rep(i, 4){
			n[r[i]] = 1;
		}
		int hit = 0, blow = 0;
		rep(i, 4){
			if(r[i] == a[i]) hit++;
			blow+=n[a[i]];
		}
		cout << hit << ' ' << blow-hit << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	string s,ss;
	cin >> s >> ss;
	if(s == "0") break;
	int hit = 0;
	int blow = 0;
	REP(i,s.size()){
	    REP(j,ss.size()){
		if(s[i] == ss[j]){
		    if(i == j) hit++;
		    else blow++;
		}
	    }
	}
	cout << hit << " " << blow<<endl;
    }
    return 0;
}