<>;for(<>){ /(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/; ++${"$1$3$5$7$9$11"}; ++${"$2$4$6$8$10"}; } $c=999; for(0..179){ $x=join'',sort{.5<=>rand}qw(i a a e u u); redo if $2{$x}++; if($c>$$x){ $c=$$x; $a=$x; } } $c=999; for(0..119){ $x=join'',sort{.5<=>rand}qw(n b m g r); redo if $2{$x}++; if($c>$$x){ $c=$$x; $b=$x; } } "$a$b"=~/(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/; print "$1$7$2$8$3$9$4$10$5$11$6\n";