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 <sstream>
//#include <fstream>

using namespace std;

int stoi (string str )
{
	stringstream ss (str );
	int n;
	ss >> n;
	
	return n;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.hit6blow", "r", stdin);
	string A = "", B = "";
	
	while (cin >> A >> B ) {
		if ( stoi(A) == 0 && stoi(B) == 0 ){
			break;
		} // end if

		int hit = 0;
		int blow = 0;
		int i,j;

		for (i = 0; i < 4; ++i){
			if (A[i] == B[i]){
				++hit;
				A[i] = B[i] = 'e';
			} // end if
		} // end for
		
		for (i = 0; i < 4; ++i){
			for (j = 0; j < 4; ++j){
				if (A[i] != 'e' && B[j] != 'e' && A[i] == B[j]){
					++blow;
					A[i] = B[j] = 'e';
				} // end if
			} // end for
		} // end for
		cout << hit << ' ' << blow << endl;
	} // end while

	return 0;
}

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

string r, a;

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

C++: #include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main(){
    string s,t;
    while(cin >> s >> t, s != "0"){
        int x = 0, y = 0;
        int a[10] = {}, b[10] = {};
        rep(i,4){
            if(s[i] == t[i])x++;
            else{
                a[s[i]-'0']++;
                b[t[i]-'0']++;
            }
        }
        rep(i,10)y += min(a[i],b[i]);
        cout << x << " " << y << endl;
    }
}

C++: // 2011/07/27 Tazoe

#include <iostream>
#include <string>
using namespace std;

int main()
{
	while(true){
		string r, a;
		cin >> r >> a;
		if(r=="0"&&a=="0")	// ツ閉カツ篠堋療ア
			break;

		int hit = 0;
		int blw = 0;
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)
				if(r[i]==a[j])
					if(i==j)
						hit++;
					else
						blw++;

		cout << hit << ' ' << blw << endl;
	}

	return 0;
}

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

int main() {
	string s, t;
	while(cin >> s >> t, s != "0" && t != "0") {
		int a[10] = {0}, b[10] = {0};
		int hit = 0, blow = 0;
		for(int i = 0; i < s.size(); i++) {
			if(s[i] == t[i])
				hit++;
			else {
				a[s[i]-'0']++;
				b[t[i]-'0']++;
			}
		}
		for(int i = 0; i < 10; i++) {
			blow += min(a[i], b[i]);
		}
		cout << hit << " " << blow << endl;
	}
}

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>
#include <string>
using namespace std;

int main(){
int h,b;
string r;
string a;
 while(true){
    cin >> r >> a;
    if(r=="0"&&a=="0"){
        break;
    }
    h=0;b=0;
    for(int i=0;i<r.size();i++){
               for(int k=0;k<a.size();k++){
                      if(r[i]==a[k]){
                                  if(i==k){
                                     h++;
                                  }else{
                                         b++;
                                      }
                         }
                 }
     }
     cout << h << ' ' << b << endl;
}
   
return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int i ,j ,n ,m ,hit=0 ,blow=0;
  char a[5] ,r[5];
  while( 1 ){
    cin >> a;
    cin >> r;

    if( a[0] == '0' && r[0] == '0' ){
      break;
    }

    for( i=0 ; i<4 ; i++ ){
      for( j=0 ; j<4 ; j++ ){
	if( a[i] == r[j] ){
	  
	  if( i == j ){
	    hit++;
	  }
	  else{
	    blow++;
	  }
	}
      }
     
    }
      
    printf( "%d %d\n" ,hit ,blow );
    hit = 0;
    blow = 0;
  }
  
  return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	string a, b;
	
	while (cin >> a >> b) {
		if (a == "0") break;
		
		int hit = 0, blow = 0;
		
		for_(i,0,4) if (a.find(b[i]) != a.npos) ++blow;
		for_(i,0,4) if (a[i] == b[i]) { ++hit; --blow; }
		
		cout << hit << " " << blow << endl;
	}
}

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<<endl;
return 0;
}

C++: // 2011/02/17 Tazoe

#include <iostream>
#include <string>		// string^ðg¤½ßÉ
using namespace std;

int main()
{
	while(true){
		string r, a;		// stringi¶ñj^
		cin >> r >> a;
		if(r=="0"&&a=="0")
			break;

		int hit = 0;
		int blw = 0;
		for(int i=0; i<4; i++)
			for(int j=0; j<4; j++)		// ½è
				if(r[i]==a[j])		// ª¯¶ÈçÎ
					if(i==j)		// Êuà¯¶ÈçÎ
						hit++;
					else
						blw++;

		cout << hit << ' ' << blw << endl;
	}

	return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  string l, r;
  while (cin >> l >> r, l != "0") {
    int a = 0;
    vc p, q;
    rep(i, 4) {
      if (l[i] == r[i]) {
        a++;
      } else {
        p.pb(l[i]), q.pb(r[i]);
      }
    }
    sort(all(p)), sort(all(q));
    vc r;
    set_intersection(all(p), all(q), back_inserter(r));
    cout << a << ' ' << r.size() << endl;
  }
}

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

int main(){
    string S,T;
    while(cin >> S >> T, S != "0" && T != "0"){
        set<char> st;
        for(char& c : S) st.insert(c);

        int hit = 0;
        int blow = 0;
        for(int i = 0; i < T.size(); i++){
            if(S[i] == T[i]) hit++;
            else blow += st.count(T[i]);
        }

        cout << hit << " " << blow << endl;
    }
}