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

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

int main(){
  char a[4],b[4];
  int x,y,hit,blow;
  int tmp;
  int i,j;

  while(1){
    cin >> x >> y;
    if(!x && !y)break;

    hit = 0;blow = 0;
    tmp = 1000;
    for(i=0;i<4;i++){
      a[i] = x/tmp;
      b[i] = y/tmp;
      x -= a[i] * tmp;
      y -= b[i] * tmp;
      tmp /= 10;
    }
    
    for(i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(a[i] == b[j]){
	  if(i == j)hit++;
	  else blow++;
	}
      }
    }
    cout << hit << " " << blow <<endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(void){
    int i,j,k,l;
    int b,h;
    char data1[5],data2[5];
    
    while(1){
   
        cin>>data1,cin>>data2;
        if(data1[0]=='0'&&data2[0]=='0')break;
       
        b=0;
        h=0;
    

        for(i=0;i<4;i++){
            for(j=0;j<4;j++){
                if(i!=j){
                    if(data1[i]==data2[j]){
                        b++;
                }
            }else{
                if(data1[i]==data2[j]){
                    h++;
                }
            }
        }
    }
        cout<<h<<" "<<b<<endl;
    }
    return(0);
}

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

char buf[10];
int main() {
	int a[4], b[4];
	while (gets(buf), strcmp(buf, "0 0")) {
		char*s = buf;
		rep(i, 4) { sscanf(s, "%1d", &a[i]); s += 1; }s += 1;
		rep(i, 4) { sscanf(s, "%1d", &b[i]); s += 1; }
		int hit = 0, blow = 0;
		rep(i, 4)if (a[i] == b[i])hit++;
		rep(i, 4) if (find(a, a + 4, b[i]) != a + 4)blow++;
		cout << hit << ' ' << blow - hit << endl;
	}
	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;
}

C++: #include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int rr[4], aa[4];
signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(r, a);
    if(!(r | a))break;

    rr[0] = r % 10; rr[1] = (r / 10) % 10; rr[2] = (r / 100) % 10; rr[3] = r / 1000;
    aa[0] = a % 10; aa[1] = (a / 10) % 10; aa[2] = (a / 100) % 10; aa[3] = a / 1000;

    int res[2] = {0};
    rep(i, 4)if(rr[i] == aa[i])++res[0];
    rep(i, 4)rep(j, 4)if(rr[i] == aa[j]){
      ++res[1]; break;
    }

    pri2(res[0], res[1] - res[0]);

//*/

//*/ break;
  }
  return 0;
}

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<bits/stdc++.h>
using namespace std;
main() {
	string r, a;
	while(1) {
		cin >> r >> a;
		if ( a == "0" ) break;
		int hit = 0, blow = 0;
		for ( int i = 0; i < 4; i++ ) {
			for ( int j = 0; j < 4; j++ ) {
				if ( r[i] != a[j] ) continue;
				if ( i == j ) hit++;
				else blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
}

C++: 
#include <iostream>
using namespace std;
int main(){
 char r[5];
 char a[5];
 int h,b;
 cin>>r>>a;
 while(1){
if(r[0]=='0'&&a[0]=='0') break;
  for(int i=0;i<4;i++){
   for(int j=0;j<4;j++){
    if(r[i]==a[i]) h++;
    else if(r[i]==a[j]) b++;
    }
   }
  cout<<h/4<<' '<<b<<endl;
  h=0; b=0;
  cin>>r>>a;
  }

 
 return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

// union-find ???????????£??????

int main(){
	
	string r, a;
	
	while(true){
		cin >> r >> a;
		if(r == "0" && a == "0"){
			break;
		}
		
		int hit = 0;
		int 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<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 <iostream>

using namespace std;

void solve()
{
	char a[5], b[5];
	while(cin >> a >> b)
	{
		if(a[0] == '0' && b[0] == '0')
		{
			break;
		}
		int Hit = 0;
		int Blow = 0;
		for(int i = 0; i < 4; ++i)
		{
			for(int j = 0; j < 4; ++j)
			{
				if(a[i] == b[j] && i == j)
				{
					++Hit;
				}
				else if(a[i] == b[j])
				{
					++Blow;
				}
			}
		}
		cout << Hit << " " << Blow << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

int main(void)
{
  string r,a;
  int hit = 0;
  int blow = 0;

  while(cin >> r >> a){

    if(r=="0" && a=="0")
      break;
    
    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++;
	      }
	  }
      }

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

  return 0;

}