This competition is over.
An honorable mention goes to Falko, who went totally crazy with the free imports.
A while ago I wanted to know how I can out-type modern smartphones with my Nokia 3310, and while some answers were really good, I still can't keep up! Maybe I should take a different approach and simply not write any words that are awkward to type.
We'll call a piece of text easily typeable if no two consecutive letters are on the same button on the telephone keyboard, given the standard layout:
Your task is to write a program/function that accepts a string
s from stdin/as a parameter and returns a truthy value if
s is easily typeable and a falsy value otherwise. The input will only consist of lowercase letters and spaces and is guaranteed to be non-empty!
This is codegolf, so lowest character-count wins.
Import statements will not be counted towards your final score, so if you've ever wanted to use
itertools.combinations in your code, now is the time!
-3 if your source code is easily typeable, assuming everything that's not a letter is on button 0. After all, I might want to message your code to some friends!
Here are a few testcases to check if your code is working as intended:
"x" -> True "aardvark" -> False "ardvark" -> True "flonk" -> False "im codegolfing all day long" -> False "i indulge in minimizing bytecount" -> True "havent heard from you in a long time" -> False "your silence was of undue permanence" -> True "how are you" -> False "how are you" -> True