DB<259> @input = glob '{a,b}' x 5
DB<260> test($_) and print "OK $_\n" for @input
OK aaaab
OK aaaba
OK aabaa
OK abaaa
OK abbbb
OK baaaa
OK babbb
OK bbabb
OK bbbab
OK bbbba
DB<261> l test
2: sub test { my $str = shift; my %h; $h{$_}++ for split //,$str;
+ my %r =reverse %h; return 1 if exists $r{1} };
DB<262>
YMMV concerning input size, but keep in mind that its $size_alphabet**$word_length .
The regex should work for all potential possibilities, neither size nor alphabet can be known.
|