#!/usr/bin/perl
require "../cgi-lib.pl";
ReadParse(*in);
@lt = qw/q r s t/;
print "Content-Type: text/html\n\n";
$combos = $in{n} || 2;

@c = combo($in{start},$combos);
$img = "http://kh.google.com/kh?v=1&t=";
foreach (@c) {
    print "$_ = <img src=\"$img$_\"><br>";
}

sub combo {
    my($str,$len) = @_;
    my(@ret);
    if(length $str >= $len) {
	return ($str);
    }
    else {
	foreach my $l (@lt) {
	    push @ret,combo("$str$l",$len);
	}
	return @ret;
    }
}
