<script type="text/javascript">
function myfind(has, other, n) {
if (n == 0) {
document.write(has.join(","));
document.write("<br/>");
return;
}
if (other.length < n) {
return;
}
var one = other.shift();
if (isIn(has, one)) {
myfind(has, other, n);
} else {
var newhas = has.concat();
var newother = other.concat();
has.push(one);
myfind(has, other, n-1);
myfind(newhas, newother, n);
}
}
function isIn(has, one) {
for (i in has) {
if (has[i].substring(0, 3) == one.substring(0, 3)) {
return true;
}
}
return false;
}
var a="777 3,777 0,888 1,999 3,765 3,765 2,771 3,798 1";
myfind(new Array(), a.split(","), 6);
</script>