Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func solve(a, b, c int) int {
	if a == 1 && b >= c && b < 10 {
		return 1
	}
	if a == 1 {
		return 0
	}
	ret := 0
	for i := c; i < 10 && i < b; i++ {
		ret += solve(a-1, b-i, i+1)
	}
	return ret
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		if a == 0 {
			break
		}
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		fmt.Println(solve(a, b, 0))
	}
}

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

int f(int n, int s, int x)
{
	if (n == 0) {
		if (s == 0) return 1;
		else return 0;
	}
	if (x >= 10) {
		return 0;
	}
	return f(n - 1, s - x, x + 1) + f(n, s, x + 1);
}

int main()
{
	int n, s;
	
	while (1) {
		cin >> n >> s;
		
		if (n == 0 && s == 0) break;
		
		cout << f(n, s, 0) << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
void dfs(int, int, int);
int coun=0,go;
int main()
{
	int n;
	while (1){
		coun = 0;
		cin >> n >> go;
		if (n + go == 0)break;
		for (int i = 0; i < 9; i++){
			dfs(n, i, i);
		}
		cout << coun << endl;
	}
}
void dfs(int n, int sum, int to){
	if (n == 1 && sum == go){
		coun++;
	}
	for (int i = to + 1; i < 10; i++){
		dfs(n - 1, sum + i, i);
	}
}

C++: #include<iostream>

int count=0;

int method(int n,int s,int k){
  if(k>9){
    return 0;
  }
  if(s==0&&n==0){
    count++;
    return 0;
  }
  method(n-1,s-k,k+1);
  method(n,s,k+1);
  return 0;
}

int main(){
  int n,s;

  while(std::cin >> n >> s){
    if(n==0&&s==0){
      break;
    }
    count =0;
    method(n,s,0);

    std::cout << count << std::endl;
  }
}