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>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }

string s1, s2;

int main() {
    while (cin >> s1 >> s2) {
        if (s1 == "0") break;
        int num[11] = {0};
        int ex = 0;
        for (int i = 0; i < 4; ++i) {
            if (s1[i] == s2[i]) ++ex;
            num[s1[i]-'0']++;
            num[s2[i]-'0']++;
        }
        int same = 0;
        for (int i = 0; i < 10; ++i) if (num[i] == 2) ++same;
        cout << ex << " " << same-ex << endl;
    }
    return 0;
}

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

int main(void){
  int Q,A,qq[4],aa[4],Hit,Blow,num;


  while(1){

    num = 1000;
    Hit = Blow = 0;

  cin >> Q >> A;
  if( Q == 0 && A == 0 ) break;

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

    qq[i] = Q / num % 10;
    aa[i] = A / num % 10;
    num/=10;

  }

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

      if( qq[i] == aa[j] && i == j ) Hit++;
      else if( qq[i] == aa[j] && i != j ) Blow++;

    }
  }

  cout << Hit << " " << Blow << endl;

  }

  return 0;
}

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

int main(){
    int a;
    int aa[4];
    int p;
    int pa[4];
    while(scanf("%d %d", &a, &p)){
        if(a == 0 && p == 0) break;
        int c = 1000;
        for(int i=0; i<4; ++i){
            aa[i] = a / c;
            a = a % c;
            pa[i] = p / c;
            p = p % c;
            c /= 10;
        }
        int hit = 0;
        int blow = 0;
        for(int i=0; i<4; ++i){
            for(int j=0; j<4; ++j){
                if(aa[i] == pa[j]){
                    if(i == j) ++hit;
                    else ++blow;
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 4;

int main(void){
    for(string A, B; cin >> A >> B, A != "0";){
        int h = 0, b = 0;

        rep(i, N){
            int ind = B.find(A.at(i));
            if(ind == i) h ++;
            else if(~ind) b ++;
        }
        cout << h << " " << b << endl;
    }
 
    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;
	}else{
	int h=0,b=0;
	for(int i;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;
	}
}
return 0;
}

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

using namespace std;

int main()
{
	char key[5],query[5];
	int hit,blow;
	
	scanf("%s %s",key,query);
	while(key[0] != '0' || key[1] != '\0'){
		hit = 0;
		blow = 0;

		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(key[j] == query[i]){
					if(i == j)
						hit++;
					else
						blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);

		scanf("%s %s",key,query);
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vllll = vector<vector<ll>>;

int main() {

    string r, a;
    while (cin >> r >> a, r != "0") {

        ll hit = 0;
        vector<bool> ext(10, false);
        for (ll i = 0; i < 4; i++) {
            if (r[i] == a[i]) {
                hit++;
            }
            ext[r[i] - '0'] = true;
        }
        ll blow = -hit;
        for (ll i = 0; i < 4; i++) {
            if (ext[a[i] - '0']) {
                blow++;
            }
        }

        cout << hit << ' ' << blow << endl;

    }

}

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

using namespace std;

int main(){
	int data[1010];
	
	int n,m;
	while(cin>>n>>m && n &&m){
		for(int i=0;i<n;i++){
			cin>>data[i];
		}
		sort(data,data+n,greater<int>());
		int ans=0;
		
		for(int i=0;i<n;i++){
			if((i+1)%m!=0)ans+=data[i];
		}
		
		cout<<ans<<endl;
	}
}

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(s[0][i] == s[1][j])
        {
            if(i == j ) h++;
            else b++;
        }
        cout << h << " " << b << endl;

    }
    return 0;
}

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  string r,a;
  while(1){
    int h=0,b=0;
    cin>>r>>a;
    if(r=="0"&&a=="0") break;
    for(int i=0;i<r.size();i++){
      for(int j=0;j<a.size();j++){
	if(r[i]==a[j]){
	  if(i==j){
	    h++;
	  }
	  else{
	    b++;
	  }
	}
      }
    }
    cout<<h<<" "<<b<<endl;
  }
}