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

Python: while True:
    r, a= input().split()
    if r==a=='0': break
    print(sum(1 for i, j in zip(r, a) if i==j), sum(1 for i in range(len(r)) for j in range(len(a)) if r[i]==a[j] and i!=j))

Python: import sys
f = sys.stdin

while True:
    r, a = f.readline().strip().split()
    if r == '0':
        break
    hit = sum(1 for ri, ai in zip(r, a) if ri == ai)
    blow = sum(1 for ai in a if ai in r) - hit

    print(hit, blow)

Python: # Aizu Problem 0226: Hit and Blow

import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def hit_and_blow(seq, guess):
    hit, blow = 0, 0
    nums = list(range(10))
    for k in range(4):
        s = seq
        if seq[k] == guess[k]:
            hit += 1
            nums.remove(int(seq[k]))
    blow = sum([str(n) in guess and str(n) in seq for n in nums])
    return hit, blow
            

while True:
    seq, guess = [_ for _ in input().split()]
    if seq == guess == "0":
        break
    hit, blow = hit_and_blow(seq, guess)
    print(hit, blow)

Python: while 1:
    a,b=input().split()
    if a=='0':break
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Python: # AOJ 0226: Hit and Blow
# Python3 2018.6.25 bal4u
 
while 1:
    r, a = input().split()
    if r == '0': break
    h = 0
    for i in range(4):
        if r[i] == a[i]: h += 1
    print(h, len(set(r) & set(a))-h)

Python: # AOJ 0226: Hit and Blow
# Python3 2018.6.23 bal4u

while 1:
	r, a = input().split()
	if r == '0': break
	h, sr, sa = 0, set(), set()
	for i in range(4):
		if r[i] == a[i]: h += 1
		else:
			sr.add(r[i])
			sa.add(a[i])
	print(h, len(sr & sa))

Python: while True:
  r, a = input().split()
  if r == "0":
    break
   
  h = 0
  for x, y in zip(r, a):
    if x == y:
      h += 1
   
  b = -h
#  print(b)
  for x in r:
    if x in a:
      b += 1
 
  print(h, b)

Python: while True:
    r, a = input().split()
    if r == a == '0': break
    h, b = 0, 0
    for i in range(4):
        if r[i] == a[i]:
            h += 1
        elif a[i] in r:
            b += 1
    print(h, b)

Python: 
while True:
    r,a = list(input().split(" "))

    if r == "0" :
        break


    r_list = [int(s) for s in list(r)]
    a_list = [int(s) for s in list(a)]

    hit_count = 0
    blow_count = 0

    for i in range(0,len(a_list)):
        if r_list[i] == a_list[i]:
            hit_count += 1
            a_list[i] = -1
            r_list[i] = -1
    while -1 in a_list:
        a_list.remove(-1)

    for i in range(0,len(a_list)):
        if a_list[i] in r_list:
            blow_count += 1
            r_list[i] = -1
    print ('%d %d' % (hit_count,blow_count))

Python: while 1:
    a,b=list(input().split())
    if len(a)==1:break
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Python: for q in range(12000):
    a, b = input().split()
    if a[0] is '0' and b[0] is '0':
        break

    hit = 0
    for i in range(4):
        if a[i] is b[i]:
            hit = hit + 1

    blow = 0
    for j in range(4):
        for i in range(4):
            if (b[j] is a[i]) and (a[i] is not b[i]) and (a[j] is not b[j]):
                blow = blow + 1

    print(hit, blow)

Python: for q in range(12000):
    a, b = input().split()
    if a[0] is '0' and b[0] is '0':
        break

    hit = sum(1 for c, d in zip(a, b) if d is c)
    blow = sum(1 for e in b if e in a) - hit
    print(hit, blow)

Python: while True:
    r,a = list(input().split(" "))

    if r == "0" and a == "0":
        break

    r_list = [int(s) for s in list(r)]
    a_list = [int(s) for s in list(a)]

    hit_count = 0
    blow_count = 0
    for i in range(0,len(a_list)):
        if r_list[i] == a_list[i]:
            hit_count += 1
            a_list[i] = -1
            r_list[i] = -1
    while -1 in a_list:
        a_list.remove(-1)

    for i in range(0,len(a_list)):
        if a_list[i] in r_list:
            blow_count += 1
            r_list[i] = -1
    print(hit_count,blow_count)

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0226

"""
import sys
from sys import stdin
input = stdin.readline


def solve(r, a):
    hit = 0
    blow = 0

    for i in range(4):
        if r[i] == a[i]:
            hit += 1
        else:
            if a[i] in r:
                blow += 1
    return hit, blow


def main(args):
    while True:
        r, a = input().split()
        if r == '0' and a == '0':
            break
        hit, blow = solve(r, a)
        print(hit, blow)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: while True:
    a,b = input().split()
    if a == b == "0":
        break
    count = 0
    for i in range(4):
        if a[i] == b[i]:
            count += 1
    print(count,end = " ")
    newcount = 0
    for j in range(4):
        if a[j] == b[0] or a[j] == b[1] or a[j] == b[2] or a[j] == b[3]:
            newcount += 1
    print(newcount - count)

Python: while True:
    r, a= input().split()
    if r==a==0: break
    print(sum(1 for i, j in zip(r, a) if i==j), sum(1 for i in range(len(r)) for j in range(len(a)) if r[i]==a[j] and i!=j))

Python: while True:
  r, a = input().split()
  if r == "0":
    break
  
  hit = 0
  for x, y in zip(r, a):
    if x == y:
      hit += 1
  
  blow = -hit
  for x in r:
    if x in a:
      blow += 1

  print(hit, blow)

Python: while 1:
    a,b=input().split()
    if a=='0':break
    h=0
    for i,j in zip(a,b):h+=i==j
    print(h,len(set(a)&set(b))-h)

Python: # AOJ 0226: Hit and Blow
# Python3 2018.6.25 bal4u

while 1:
	r, a = input().split()
	if r == '0': break
	h = 0
	for i in range(4):
		if r[i] == a[i]: h += 1
	print(h, len(set(r) & set(a))-h)

Python: while True:
    A,B = map(list, input().split())
    if len(A) == 1:
        break
    hit=0
    blowPlusHit=0
    for i in range(4):
        if A[i] == B[i]:
            hit+=1
        for j in range(4):
            if A[i]==B[j]:
                blowPlusHit += 1
    print(f"{hit} {blowPlusHit-hit}")

Python: for q in range(12000):
    a = tuple(map(int, input().split()))
    b = input()
    if a[0] == 0 and b[0] == '0':
        break

    hit = 0
    for i in range(4):
        if a[i] == int(b[i]):
            hit = hit + 1

    blow = 0
    for j in range(4):
        for i in range(4):
            if (int(b[j]) == a[i]) and (a[i] != int(b[i])) and (a[j] != int(b[j])):
                blow = blow + 1

    print(hit, blow)

Python: while True:
    hit=0
    bur=0
    a,una=(input().split())
    if a=='0' and una=='0':
        break
    a=list(a)
    una=list(una)
    for k in range(4):
        if a[k]==una[k]:
            hit+=1
    for d in range(4):
        for s in range(4):
            if a[d]==una[s]:
                bur+=1
    print(str(hit)+' '+str(bur-hit))