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>
#include <string.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
char a[4], b[4]; int  hit, blow;
int main() {
	while (true) {
		scanf("%s%s", a, b);
		if (strlen(a) == 1 && strlen(b) == 1) break;
		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++;
					}
					else {
						blow++;
					}
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

int main(){
	string s1, s2;
	while(cin >> s1 >> s2){
		if(s1 == "0" && s2 == "0") break;
		int h = 0, b = 0;
		for(int i = 0; i < 4; i++){
			if(s1[i] == s2[i]) h++;
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(i == j) continue;
				if(s1[i] == s2[j]) b++;
			}
		}
		cout << h << " " << b << endl;
	}
	return 0;
}

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<bits/stdc++.h>
using namespace std;
int main(){
  string str1,str2;
  int a,b,c[10];
  while(cin >> str1 >> str2,str1!="0"||str2!="0"){
    a=0;
    b=0;
    for(int i=0;i<10;i++) c[i] = 0;
    for(int i=0;i<4;i++){
      if(str1[i] == str2[i]) a++;
      else {
	c[str1[i]-'0']++;
	if(c[str1[i]-'0'] == 2) b++;
	c[str2[i]-'0']++;
	if(c[str2[i]-'0'] == 2) b++;
      }
    }
    cout << a << " " << b << endl;
  }
  return (0);
}

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

int main(){
  string sol,ans;
  while(cin >> sol >> ans,sol!="0"&&ans!="0"){
  int hit=0,blow=0;
    for(int i=0;i<4;i++){
	  for(int n=0;n<4;n++){
	    if(sol[i]==ans[n]){
		  if(i==n)hit++;
		  else blow++;
		}
	  }
	}
	cout << hit << ' ' << blow << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <stack>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <climits>

using namespace std;

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

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

int main()
{
	char str1[8], str2[8];
	while(scanf("%s%s", str1, str2), strcmp(str1, "0")){
		int hit=0, blow=0;
		rep(i, 4){
			if(str1[i] == str2[i])
				++hit;
			else
				blow += find(str2, str2+4, str1[i]) != str2+4;
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
	char a[10],b[10];
	while(true){
	cin>>a>>b;
	if(strcmp(a,"0")==0&&strcmp(b,"0")==0)break;
	int x=0,y=0;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(i<j)continue;
			if(a[i]==b[j]){
			if(i==j)x++;
			else y++;
			}			

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

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

int main(){

	while(true){
		string stl1;
		string stl2;
		cin>>stl1;
		cin>>stl2;
	
		if(stl1=="0"&&stl2=="0")
			break;

		int h=0,b=0;
	
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(stl1[i]==stl2[j]){
					if(i==j){
						h++;
					}
					else{
						b++;
					}
				}
			}
		}
		cout<<h<<' '<<b<<endl;
	}
	return 0;
}

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

int main() {
	string r, a;
	while(cin >> r >> a , r || a){
		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++;
                	}
                }
            }
        }
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    string s[2];

    while(cin >> s[0] >> s[1])
    {
        if(s[0] == "0") break;
        int h = 0, b = 0;

        REP(4)if(s[0][i] == s[1][i]) h++;

        REP(4)rep(j,4)
        {
            if(i == j ) continue;
            if(s[0][i] == s[1][j]) b++;
        }
        cout << h << " " << b << endl;

    }
    return 0;
}

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

using namespace std;

void solve()
{
	string ans, inquire;
	while(cin >> ans >> inquire)
	{
		if(ans == "0" && inquire == "0")
		{
			break;
		}
		int hit = 0, blow = 0;
		for(int i = 0; i < ans.size(); ++i)
		{
			if(ans[i] == inquire[i])
			{
				++hit;
			}
		}
		for(int i = 0; i < ans.size(); ++i)
		{
			for(int j = 0; j < inquire.size(); ++j)
			{
				if(ans[i] == inquire[j])
				{
					++blow;
				}
			}
		}
		cout << hit << " " << blow - hit << endl;
	}
}

int main()
{
	solve();
	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] ) {
				cout << r[i] << " " << a[i] << endl;
				hit++;
			}
			else {
				for ( int j = 0; j < 4; j++ ) {
					if ( r [i] == a[j] ){
						blow++;
						cout << r[i] << " " << a[j] << endl;
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	string s1,s2;
	while(cin>>s1>>s2,s1!="0"){
		int a=0,b=0;
		rep(i,4){
			if(s1[i]==s2[i]){
				a++;
			}
		}
		rep(i,4){
			rep(j,4){
				if(s1[i]==s2[j]){
					b++;
				}
			}
		}
		cout<<a<<" "<<b-a<<endl;
	}
}