12
0
One aspect of password strength testing is runs of adjacent letters on the keyboard. In this challenge, a program must be created that returns true
if a string contains any runs of adjacent letters.
What counts as a run of adjacent letters?
For this simplified version of a password strength tester, a run of adjacent characters is 3 or more letters which are next to each other in a single direction (left, right, above or below) on a QWERTY keyboard. For the purpose of this challenge the layout of the keyboard looks like this:
1234567890
QWERTYUIOP
ASDFGHJKL
ZXCVBNM
In the diagram above Q
is below 1
but not below 2
, so a string that contains 1qa
or aq1
anywhere inside it would make the program return true
, but 2qa
would not.
Input
The password string to check. It will only contain the characters [0-9a-z]
or [0-9A-Z]
(your choice).
Output
The program must return a truthy value if the password contains one or more runs of adjacent keys, or falsey if it contains none.
Examples
The following inputs should output true:
asd
ytrewq
ju7
abc6yhdef
And these inputs should output false:
abc
aaa
qewretry
zse
qwdfbn
pas
Rules
- Answers may be complete programs or functions.
- Standard loopholes are disallowed.
- This is code-golf, lowest score (in bytes) wins!
Duplicate of http://codegolf.stackexchange.com/questions/48406/is-the-word-typeable-with-keys-adjacent-to-each-other?
– orlp – 2015-11-27T06:58:11.490