#!/usr/bin/perl

$choices = shift;
$pat = shift;

$pat =~ s/\./\[$choices\]/g;

@res =  `egrep '$pat' /afs/sipb/project/sipbsrc/src/mboggle/words/allwords`;
for $r (@res){
	@c = split(//, $choices);
	$good = 1;
	for $c (@c){
		if(($r=~s/$c/$c/g) > ($choices=~s/$c/$c/g)){
			$good = 0;
		}
	}
	print $r if($good);
}
