in reply to Another word puzzle with too many permutations

Why don't you just count the letters???

my %max =( A=>8, B=>2, C=>5, D=>8, E=>7, F=>1, G=>3, H=>9, I=>8, K=>1, L=>9, M=>1, N=>12, O=>13, P=>1, Q=>0, R=>5, S=>6, T=>4, U=>6, V=>0, W=>1, X=>1, Y=>0, Z=>0); my @n = qw(Affenpinscher AfghanHound AiredaleTerrier Akita AlaskanMala +mute AmericanEnglishCoonhound AmericanEskimoDog AmericanFoxhound Base +nji BassetHound Beagle BeardedCollie Beauceron BlackandTanCoonhound B +loodhound BluetickCoonhound BorderCollie BorderTerrier Borzoi BostonT +errier BouvierdesFlandres Boxer BoykinSpaniel Briard Brittany Brussel +sGriffon BullTerrier Bulldog Bullmastiff ChesapeakeBayRetriever Chihu +ahua ChineseCrested ChineseShar-Pei Chinook ChowChow ClumberSpaniel C +ockerSpaniel Collie Curly-CoatedRetriever Dachshund Dalmatian DandieD +inmontTerrier DobermanPinscher DoguedeBordeaux EnglishCockerSpaniel E +nglishFoxhound EnglishSetter EnglishSpringerSpaniel GermanPinscher Ge +rmanShepherdDog GermanShorthairedPointer GermanWirehairedPointer Gian +tSchnauzer GlenofImaalTerrier GoldenRetriever GordonSetter GreatDane +Greyhound Harrier IbizanHound IcelandicSheepdog IrishSetter IrishTerr +ier Kuvasz LabradorRetriever LakelandTerrier LhasaApso Lowchen Maltes +e ManchesterTerrier Mastiff MiniatureBullTerrier MiniaturePinscher Mi +niatureSchnauzer NeapolitanMastiff Newfoundland NorfolkTerrier Peking +ese PembrokeWelshCorgi PharaohHound Plott PortugueseWaterDog Pug Puli + PyreneanShepherd RatTerrier ShibaInu ShihTzu SiberianHusky SilkyTerr +ier SkyeTerrier SmoothFoxTerrier SoftCoatedWheatenTerrier SpinoneItal +iano St.Bernard StaffordshireBullTerrier WireFoxTerrier WirehairedPoi +ntingGriffon Xoloitzcuintli YorkshireTerrier); WORD: for my $word (@n) { my %count=%max; for $c ( split //, uc($word) ) { next WORD if $count{$c}-- <=0; } print "$word\n"; }

output:

AfghanHound AiredaleTerrier Akita AmericanEnglishCoonhound AmericanFoxhound BassetHound Beagle BeardedCollie Beauceron BlackandTanCoonhound Bloodhound BluetickCoonhound BorderCollie BorderTerrier BostonTerrier Boxer Briard BullTerrier Bulldog Chihuahua ChineseCrested Chinook ClumberSpaniel CockerSpaniel Collie Dachshund Dalmatian DandieDinmontTerrier DobermanPinscher DoguedeBordeaux EnglishCockerSpaniel EnglishFoxhound EnglishSetter GermanPinscher GermanShepherdDog GermanShorthairedPointer GermanWirehairedPointer GlenofImaalTerrier GordonSetter GreatDane Harrier IcelandicSheepdog IrishSetter IrishTerrier LakelandTerrier LhasaApso Lowchen Maltese ManchesterTerrier MiniatureBullTerrier MiniaturePinscher Newfoundland NorfolkTerrier Pekingese PembrokeWelshCorgi PharaohHound Plott PortugueseWaterDog Pug Puli RatTerrier ShibaInu SmoothFoxTerrier SoftCoatedWheatenTerrier SpinoneItaliano WireFoxTerrier

Cheers Rolf

( addicted to the Perl Programming Language)

update

If characters like dash or dot are allowed prepend grep {/[A-Z]/} to the for condition, e.g "St.Bernard" will be included too.

Replies are listed 'Best First'.
Re^2: Another word puzzle with too many permutations
by sarchasm (Acolyte) on Oct 15, 2013 at 18:20 UTC
    I am very intrigued by this approach and will explore it a bit more. I should end up with a list of the "10" words that use all of the available letters. Also, I checked the resulting output and it doesn't include "Xolitzcuintli" but that's because I forgot to include 1 "Z". It does appear in the output when I set Z to 1. This does leave me with a much smaller list but I would still have to identify the 10 words out of the 72 that create the solution.
      > that use all of the available letters

      please be precise, AUDI has only one D in the example given.

      changing my code to show only exact matches is no problem, just check at the end if all values are 0.

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        but the combination of auDi and forD has the 2 D's that create the solution.