13
Before reading this I suggest reading this little puzzle: https://puzzling.stackexchange.com/questions/11408/longest-word-with-adjacent-letters-on-a-keyboard
I want you to make a program that takes one argument, a word (only lowercase letters), and outputs "Yes" if the word can be typed with adjacent keys on the keyboard (see the article) and "No" if the word can't be typed with adjacent letters.
Here's the keyboard layout used in this challenge:
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
| Q | W | E | R | T | Y | U | I | O | P |
└─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┘
| A | S | D | F | G | H | J | K | L |
└─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┘
| Z | X | C | V | B | N | M |
└───┴───┴───┴───┴───┴───┴───┘
Remember: this is codegolf so the the shortest answer wins!
Can we assume that the input consists only of letters? Can we assume that they are all given in a single case? – Martin Ender – 2015-04-03T12:27:09.217
2I'm confused by this: "Two adjacent keys can max have 1.5 * the space of a key between them." Surely adjacent keys are actually adjacent, that is, they have no space between them, as in the linked puzzle? – Luke – 2015-04-03T12:51:47.547
How to take argument? STDIN? A function? – theonlygusti – 2015-04-03T16:58:43.007