import ; import ; main(args(2)) := let result[i] := args[i] ++ ": " ++ boolToString(can_make_word(args[i], InitBlocks)); in delimit(result, '\n'); InitBlocks := ["BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS", "JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM"]; can_make_word(word(1), blocks(2)) := let choices[i] := i when some(blocks[i] = toUpper(head(word))); blocksAfterChoice[i] := blocks[(1 ... (choices[i] - 1)) ++ ((choices[i] + 1) ... size(blocks))]; in true when size(word) = 0 else false when size(choices) = 0 else some(can_make_word(tail(word), blocksAfterChoice)); toUpper(letter(0)) := let ascii := asciiToInt(letter); in letter when ascii >= 65 and ascii <= 90 else intToAscii(ascii - 32);