My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.
This is obviously frustrating but it is most frustrating when you want to enter a movie title which requires navigating a keyboard that looks like this:
a b c d e f
g h i j k l
m n o p q r
s t u v w x
y z 1 2 3 4
5 6 7 8 9 0
Your task is to take as input a movie title and calculate how "frustrating" it is to type that movie title. The frustration number of a particular string is the number of letters that require moving right from the letter before them. We don't care how far right they are, since if we start moving right we pretty much instantly go to the end of the line, and we don't care about up, down or leftwards movement because they are easy.
For example if we wanted to type in
keyboard
- We start at
k
for free. e
is just abovek
so we don't need to move right.y
is all the way left so no need to move right.b
however is on the next column rightwards so we need to move right to get to it.o
is on the next column over so we have to move rightwards to get to it.a
is back in the first column so we move left to get to it.r
is all the way on the right so we move right to it.d
is two columns to the left ofr
's column.
The characters that need to move to the right are bor
meaning that this is frustration 3.
Additional rules
This is a code-golf challenge so your answers will be scored in bytes with fewer bytes being better. The input will always consist of alphanumeric characters, you can support either capital or lowercase letters and you only need to support one. The input will never be empty.
Testcases
keyboard -> 3
2001aspaceodyssey -> 6
sorrytobotheryou -> 8
thinblueline -> 5
blast2 -> 3
"blast2" -> 3
(not a real movie, but some answers have problems with such test cases) \$\endgroup\$90 -> 1
\$\endgroup\$