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

Python: while True :
    a, b = map(int, input().split())
    if a == 0 and b == 0 :
        break
    
    hit = 0
    blow = 0
    if a//1000 == b//1000 :
        hit += 1
    if (a%1000)//100 == (b%1000)//100 :
        hit += 1
    if (a%100)//10 == (b%100)//10 :
        hit += 1
    if a%10 == b%10 :
        hit += 1
    if a//1000 == (b%1000)//100 or a//1000 == (b%100)//10 or a//1000 == b%10 :
        blow += 1
    if (a%1000)//100 == b//1000 or (a%1000)//100 == (b%100)//10 or (a%1000)//100 == b%10 :
        blow += 1
    if (a%100)//10 == b//1000 or (a%100)//10 == (b%1000)//100 or (a%100)//10 == b%10 :
        blow += 1
    if a%10 == b//1000 or a%10 == (b%1000)//100 or a%10 == (b%100)//10 :
        blow += 1
    print(hit, blow)

Python: answer_list = []
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
    answer_list.append(str(hit_count) + " " + str(blow_count))
for ans in answer_list:
    print(ans)

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(str(hit_count) + str(blow_count))

Python: while True:
    s, t = input().split()
    if s == "0" and t == "0":
        break
    
    S = [int(x) for x in list(s)]
    T = [int(x) for x in list(t)]
    
    hit = 0
    blow = 0
    for i in range(len(T)):
        if T[i] in S:
            blow += 1
        if T[i] == S[i]:
            blow -= 1
            hit  += 1
    
    print(hit, blow)

Python: while 1:
    x,y = map(list,input().split())
    if x == ['0'] and y== ['0']: break

    h = b = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            h += 1
        elif y[i] in x:
            b += 1

    print ('%d %d' % (h,b))

Python: while 1:
    r, a = map(int, input().split())
    if r == 0:
        break

    pro = list(str(r).zfill(4))
    ans = list(str(a).zfill(4))

    hit = 0
    blow = 0
    for p, a in zip(pro, ans):
        if p == a:
            hit += 1
        elif a in pro:
            blow += 1

    print(hit, blow)

Python: while True:

    a, b = input().split()

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

    a1 = 0
    a2 = 0

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

    for i in range(4):
        for j in range(4):
            if a[i] == b[j]:
                a2 += 1

    print(a1, a2-a1)

Python: while True:
    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)

C++: #include <stdio.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 (a == "0" && b == "0") break;
		hit = 0; blow = 0;
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) hit++;
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					blow++; hit--;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)

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

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

using namespace std;

int main(){
while(true){
	string strr;
	string stra;
	cin>>strr>>stra;
	if(strr=="0"&&stra=="0"){
		break;
	}
	int h=0,b=0;
	for(int i;i<4;i++){
		for(int j=0;j<4;j++){
			if(strr[i]==stra[j]){
				if(i==j){
					h++;
				}else{
					b++;
				}
			}
		}
	}
	cout<<h<<' '<<b<<endl;
}
return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
while(;;){
int a,b;
cin >> a >> b;
if(a==0&&b==0)return 0;
int x[4],y[4];
for(int i=0;i<4;i++){
x[i]=a%10;
a/=10;
y[i]=b%10;
b/=10;
}

int hit=0,blow=0;
for(int i=0;i<4;i++)if(x[i]==y[i])hit++;

for(int i=0;i<4;i++){
for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
}
blow-=hit;

printf("%d %d\n",hit,blow);
}

C++: #include<iostream>
int main(){
	while(1){
		int a,b;
		std::cin>>a>>b;
		if(a==0&&b==0)break;
		std::vector<int> vec(4);
		std::vector<int> vec2(4);
		int n=1000;
		for(int i=0;i<4;i++){
			int x=a/n;
			int y=b/n;
			vec[i]=x;
			vec2[i]=y;
			x*=n;
			y*=n;
			a-=x;
			b-=y;
			n/=10;
		}
			int c=0,d=0;
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(vec[i]==vec2[j]){
					if(i==j)c++;
					else d++;
				}
			}
		}

		std::cout<<c<<" "<<d<<std::endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<cctype>
#include<cstring>
#include<string>
using namespace std;
int main(){
    string a,b;
    while(1){
        cin >> a >> b;
        if(a[0] == '0' && b[0] == '0'&&a[1] == '\0')break;
        int h=0,bl=0;
        for(int i = 0;i < 4; i++){
            for(int j = 0;j < 4; j++){
                if(a[i] == b[j] && i == j){
                    h++;
                }
                else if(a[i] == b[j]){
                    bl++;
                }
            }
        }
        printf("%d %d\n",h,bl);
    }
    return 0;
}

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

using namespace std;

int main(){
while(1){
	string r;
	string a;
	cin>>r>>a;
	if((r=="0")&&(a=="0")){
		break;
	}
	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<<'\n';
}
return 0;
}

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

int main(){
 
 char qwe[6],ans[6];

 int hit,blow,count;

 cin >> qwe >> ans;
 
 while(hit == 4){
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   count++
 }

  while(hit == 4 || count == 0){
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   
   count--;
 }

 return 0;
}