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++: <?php
	for( $loop_cnt = 0;12000 > $loop_cnt; $loop_cnt++ )
	{
		$input = explode(" ", trim(fgets(STDIN)));
		if( 0 == $input[0] &&
			0 == $input[1]
		)
		{
			break;
		}
		
		$r = str_split($input[0]);
		$a = str_split($input[1]);
		
		$hit = 0;
		$brow = 0;
		$loop_r = 0;
		foreach( $r as $r_char )
		{
			$loop_a = 0;
			foreach($a as $a_char)
			{
				if($r_char == $a_char)
				{
					if($loop_r == $loop_a)
					{
						$hit++;
					}
					else
					{
						$brow++;
					}
					break;
				}
				$loop_a++;
			}
			$loop_r++;
		}
		echo $hit . " " . $brow . "\n";
	}
?>

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


int main(){

string st;
string ss;
int n[5]={},np[5]={};
int x=0,y=0;

while(1){
cin>>st>>ss;
if(st=="0"&&ss=="0")break;
for(int i=0;i<4;i++)
{
n[i]=st[i]-'0';np[i]=ss[i]-'0';
}

for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{if(n[i]==np[j]&&i==j)x++;
else if(n[i]==np[j]&&i!=j)y++;
}

cout<<x<<" "<<y<<endl;
x=0;y=0;
}
return 0;
}

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

int main()
{	
	char r[5], a[5];

	cin >> r >> a;

	while (atoi(r) != 0 || atoi(a) != 0) {
		int h = 0, b = 0;

		for (int i = 0; i < 4; i++) {
			for(int j = 0; j < 4; j++)
				if (r[i] == a[j]) {
					if (i == j)
						h++;
					else
						b++;
				}
		}

		cout << h << " " << b << endl;
		cin >> r >> a;
	}

	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 << " " << h << endl;
	}
}

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

using namespace std;

int main()
{
	char a[5], b[5];

	while (1){
		int hit = 0, blow = 0;

		scanf("%s %s", a, b);
		
		if (a[0] == '0' && b[0] == '0'){
			break;
		}

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

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

using namespace std;
int main(void)
{
	string question,answer;

	while( cin >> question >> answer && question != "0" ){
		int hit = 0;
		int blow = 0;

		for( int i = 0;i < 4;i++ ){
			if( question[i] == answer[i] ){
				question[i] = answer[i] = -1;
				hit++;
			}
		}
		for( int i = 0;i < 4;i++ ){
			for( int j = 0;j < 4;j++ ){
				if( question[i] == -1 ) continue;
				if( question[i] == answer[j] ) blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  string str,str2;

  while(  cin >> str >> str2,(str[0] - '0')+(str2[0] - '0') ){
    int hit = 0,brow = 0;
    for(int i = 0 ; i < str.size() ; i++){
      if(str[i] == str2[i])hit++;
    }
    for(int i = 0 ; i < 4 ; i++ ){
      for(int j = 0 ; j < 4 ; j++ ){
	if(str[i] == str2[j])brow++;
      }
    }
    cout << hit << " " << brow - hit << endl;
}
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s1,s2;
  while(1){
    cin>>s1>>s2;
    if(s1.size()<4 && s2.size()<4)break;
    int h=0,b=0;
    vi a(10,0);
    rep(i,4){
      if(s1[i]==s2[i])h++;
      a[s1[i]-'0']++;
      a[s2[i]-'0']++;
    }
    rep(i,10)
      if(a[i]==2)b++;
    cout<<h<<" "<<b-h<<endl;
  }
}

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

int main() {
	string r, a;
	while(cin >> r >> a, ans=="0" && forecast=="0"){
		int hit = 0, blow = 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{
                        blow++;
                	}
                }
            }
        }
        cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const double eps=1e-9;
typedef vector<int> vi;
typedef long long ll;
string a,b;
int main(void)
{
    while(cin >> a >> b && a!="0") {
        int hit=0,blow=0;
        set<int> st;
        for (int i = 0; i < 4; i++) {
            st.insert(int(a[i]-'0'));
        }
        for(int i=0;i<4;i++)
        {
            if(a[i]==b[i])
            {
                hit++;
                continue;
            }
            else
            {
                auto it=st.find(int(b[i]-'0'));
                if(it!=st.end()) blow++;
            }
        }
        cout << hit << ' ' << blow << endl;
    }

  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);


int main() {
	string a, b;
	while (cin >> a >> b && (a != "0" || b != "0")) {

		int a1 = 0, a2 = 0;
		rep(i, 4)a1 += a[i] == b[i];
		rep(i, 10)a2 += min(count(all(a), '0' + i), count(all(b), '0' + i));
		Cout2(a1, a2 - a1);
	}
}