37 lines
758 B
Markdown
37 lines
758 B
Markdown
|
# 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:
|
||
|
|
||
|
```text
|
||
|
abcd
|
||
|
```
|
||
|
|
||
|
```text
|
||
|
qwer
|
||
|
```
|
||
|
|
||
|
```text
|
||
|
hjklo
|
||
|
```
|
||
|
|
||
|
## Output
|
||
|
|
||
|
Your program should emit the longest valid English language word you can make for each keyboard configuration.
|
||
|
|
||
|
## Challenge Output
|
||
|
|
||
|
```text
|
||
|
longestWord("abcd") ➞ "abaca"
|
||
|
longestWord("edcf") ➞ "deeded"
|
||
|
longestWord("bnik") ➞ "bikini"
|
||
|
longestWord("poil") ➞ "lollipop"
|
||
|
longestWord("vybu") ➞ "bubby"
|
||
|
longestWord("subtoxymerhlac") ➞ "carboxymethylcelluloses"
|
||
|
```
|