2
$\begingroup$

I'm looking for three seven letter words consisting of 21 unique letters, and the final result must exclude either the letters HM or QS (Excluding S may be impossible based off of my own attempts). One word MUST include V. The closest I was able to get by hand (admittedly without the excluded letters) is:

  • Swarthy Flocked Bumping (or Jumping)
  • Mitzvah Cyborgs Flunked (or Plunked)

Please use the YAWL wordlist.

$\endgroup$
5
  • $\begingroup$ Welcome to Puzzling.SE! Is this a puzzle of your own creation, or is it one you've found elsewhere and are trying to solve? $\endgroup$
    – F1Krazy
    Commented Aug 16 at 12:02
  • 1
    $\begingroup$ @F1Krazy, it doesn't look like a puzzle. I looks like a step in the preparation of a puzzle. (Or a programming exercise.) I guess OP is looking for ways how to go about such constraints. The puzzle-creation tag might be useful. $\endgroup$
    – M Oehm
    Commented Aug 16 at 12:15
  • $\begingroup$ I dabble in agrammatical pangrams, like Pa Xi Jo Qs Brazing Kvetchy Mudflow. $\endgroup$ Commented Aug 16 at 16:36
  • $\begingroup$ @MOehm from my understanding, that tag is for when the question is about how to create a puzzle, not when the result will be incidentally used for a puzzle. This puzzle could just be a little brainteaser, as-written. $\endgroup$
    – bobble
    Commented Aug 20 at 18:18
  • 1
    $\begingroup$ @bobble: Touché. This was the first of OP's questions and the requirements looked as if they might be needed to create a specific puzzle, but the current puzzle is just more of the same with changed requirements. It's not a classical brainteaser imo, because most people here will just see it as a nice programming exercise. So, yeah, I proposed that tag, but it's probably not appropriate, since OP claims just to "dabble in pangrams". $\endgroup$
    – M Oehm
    Commented Aug 20 at 18:36

2 Answers 2

4
$\begingroup$

Here are some found solutions, there should be all of them in the given word list.

#     WORD1     WORD2     WORD3    UNUSED
-----------------------------------------
1    BRAZING + KVETCHY + MUDFLOW    JPQSX
2    FLIGHTY + PROVEND + ZAMBUCK    JQSWX
3    PERVING + TWYFOLD + ZAMBUCK    HJQSX
4    PREVING + TWYFOLD + ZAMBUCK    HJQSX
5    PROVEND + WIGHTLY + ZAMBUCK    FJQSX

Five solutions only...

@Lukas Rotter Many thanks for pointing out the error in the previous version!


Used newly UPDATED py code:

ALL_LETTERS = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

words = []
with open('word.list') as stream:
    for line in stream.readlines():
        word = line.strip()
        if len(word) == 7 and len(set(word)) == 7:
            words.append(word.upper())

print(len(words))

vowels = set('AEIOUY')
dic = {}    # vowels --> list of words involving these vowels

for word in words:
    used_vowels = list(vowels.intersection(word.upper()))
    used_vowels.sort()
    used_vowels = ''.join(used_vowels)

    if used_vowels not in dic:
        dic[used_vowels] = []
        
    dic[used_vowels].append(word)
    
keys = list(dic)
keys.sort()

solutions = []
for ae in keys:
    for io in keys:
        if io <= ae:    continue 
        if set(ae).intersection(io):    continue
        for uy in keys:
            if uy <= io:    continue
            if set(uy).intersection(ae + io):    continue

            # print(f"TRYING {ae} {io} {uy}")
            for ae_word in dic[ae]:
                for io_word in dic[io]:
                    if len(set(ae_word + io_word)) < 14:    continue
                    for uy_word in dic[uy]:
                        letters = ae_word + io_word + uy_word
                        if len(set(letters)) < 21:    continue

                        unused = list(ALL_LETTERS.difference(letters))
                        unused . sort()
                        if ( 'V' in letters
                             and ( set('HM').issubset(unused) or 
                                   set('QS').issubset(unused) ) ):

                            sol = [ae_word, io_word, uy_word]
                            sol.sort()

                            solutions.append((sol, ''.join(unused)))

solutions.sort()
for counter, (sol, unused) in enumerate(solutions):
    ae_word, io_word, uy_word = sol
    print(f'    {counter + 1}    {ae_word} + {io_word} + {uy_word}    {unused}')
                  

(The code was rearranged in the final check condition to be simpler to digest also for readers that have no or limited python experience.)

$\endgroup$
7
  • 2
    $\begingroup$ Most if these do not have the required exclusions. $\endgroup$ Commented Aug 16 at 15:36
  • $\begingroup$ @DanielMathias Oh, there was too much copy+paste... i have 'HM' twice in the code... ok, i will edit, thanks for directing my attention... $\endgroup$
    – dan_fulea
    Commented Aug 16 at 15:40
  • 2
    $\begingroup$ I have no idea about python, but it looks like intersection() searches for the string "HM" rather than the chars ['h', 'm'], which is why there are so many invalid solutions here. $\endgroup$ Commented Aug 16 at 16:48
  • $\begingroup$ Let us take an example. ALL_LETTERS is a set in python. Then something like ALL_LETTERS.intersection('HM') takes the method intersection of the set instance, and applies it as "intersection with all letters" with the given argument. When this argument is a set, then it is ok. When not, it's converted to a set. In our case, set('HM') is {'H', 'M'}. So we intersect all letters with the set of individual letters in the string 'HM'. You can try the code on each computer, install python, if not already there, the OP file should be in ., then start pyhton and copy+paste the code. $\endgroup$
    – dan_fulea
    Commented Aug 16 at 18:06
  • $\begingroup$ The code produces solutions, if this issue with H and M would really be an issue, then BOSTRYX + FLUMPED + VACKING would show up on position $31$, with missing letters HJQWZ. @LukasRotter $\endgroup$
    – dan_fulea
    Commented Aug 16 at 18:11
3
$\begingroup$

The MVP here is the St John Ambulance attendant

brazing, kvetchy, mudflow
flighty, provend, zambuck
perving, twyfold, zambuck
preving, twyfold, zambuck
provend, wightly, zambuck

$\endgroup$
2
  • $\begingroup$ Out of interest, how did you derive this list? Particular software? Code? $\endgroup$
    – Stiv
    Commented Aug 16 at 13:23
  • 1
    $\begingroup$ @Stiv I wrote code for it which uses precomputed Set<char>s for each word for faster filtering. $\endgroup$ Commented Aug 16 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.