in reply to Puzzle Regex: Letter Frequency Arithmetic Sequence
G'day QM,
TMTOWTDI. Here's "pm_1201500_dict_char_ordered_count.pl":
#!/usr/bin/env perl use strict; use warnings; use constant MIN_LENGTH => 10; # 1+2+3+4 RECORD: while (<>) { next RECORD unless MIN_LENGTH < length; next RECORD unless /^([a-z]+)$/; my %char_count_of; $char_count_of{substr $1, $_, 1}++ for 0 .. length($1) - 1; my $check = 1; for (sort { $a <=> $b } values %char_count_of) { next RECORD unless $_ eq $check++; } print; }
Looking for words with ten characters or more:
$ pm_1201500_dict_char_ordered_count.pl /usr/share/dict/words beerbibber chachalaca isoosmosis kotukutuku rememberer sereneness sleeveless
Changing MIN_LENGTH:
use constant MIN_LENGTH => 6; # 1+2+3
I get all of those ten-character words, interspersed amongst over a hundred six-character words, starting with
$ pm_1201500_dict_char_ordered_count.pl /usr/share/dict/words | head - +5 allele amamau ananas ananda annona
and ending with
$ pm_1201500_dict_char_ordered_count.pl /usr/share/dict/words | tail - +5 ubussu venene wedded weeded weewow
— Ken
|
|---|