On Sun, Dec 08, 2002 at 09:37:51PM -0500, Chris Devers wrote: > On Mon, 9 Dec 2002, Mark Fowler wrote: > > > I don't know, showing this to a load of Perl coders. Of course we're > > not going to try and work it out, we're going to try and hack the > > system. This is such an incitement for a script that sends all the > > numbers from one to hundred thousand to the list ;-) > > Surprisingly good word puzzle heard on pop radio this weekend: > > Consider the word wored 'chewed'. It has two personal pronouns in it -- > 'he' and 'we'. Can you find a six letter word that has six pronouns it it?
Best I can find is "ushers" which has five. #!/usr/bin/perl -w use strict; my @pronouns = qw( I you he she we they it me him her us them mine yours his hers its ours theirs ); =for repeated pronouns, which give more but still not a six my @pronouns = qw( I you he she it we you they me you him her it us you them mine yours his hers its ours yours theirs ); =cut my $pronoun_letters = join '', @pronouns; my $words = q[/usr/share/dict/words]; my %count; open WORDS, $words or die "Couldn't find words '$words': $!\n"; while (<WORDS>) { next unless /^[$pronoun_letters]{6}$/; chomp; $count{$_} = 0; for my $p (@pronouns) { $count{$_}++ if /$p/i; } print "Ding! Ding! Ding!\n$_\n", last if $count{$_} > 5; } close WORDS; for my $w (sort {$count{$b} <=> $count{$a}} keys %count) { print "Found $count{$w} in $w\n"; } __END__ I haven't looked at Kake's code so I might've missed something. Paul -- Paul Makepeace ....................................... http://paulm.com/ "If a tree falls in the forest, then be careful about the slippery slope." -- http://paulm.com/toys/surrealism/