758 B
758 B
Broken Keyboard
Help! My keyboard is broken, only a few keys work any more. If I tell you what keys work, can you tell me what words I can write?
(You should use the trusty dictionary1.txt file, located at assets folder).
Input
A string of letters representing the keys that work on the keyboard, example:
abcd
qwer
hjklo
Output
Your program should emit the longest valid English language word you can make for each keyboard configuration.
Challenge Output
longestWord("abcd") ➞ "abaca"
longestWord("edcf") ➞ "deeded"
longestWord("bnik") ➞ "bikini"
longestWord("poil") ➞ "lollipop"
longestWord("vybu") ➞ "bubby"
longestWord("subtoxymerhlac") ➞ "carboxymethylcelluloses"