Keypad Taps
Medium · rating 1350 · Strings, Hashing
On an old phone keypad, letters share number keys and are typed by repeated taps: 2→abc, 3→def, 4→ghi, 5→jkl, 6→mno, 7→pqrs, 8→tuv, 9→wxyz. The first letter on a key needs 1 tap, the second 2, and so on. Read a lowercase word and print the total taps.
Constraints: 1 ≤ length ≤ 105
Related problems
- Count Anagram Groups — Medium
- Election Winner — Medium
- Sort by Frequency — Medium
- First Unique Character — Medium
- Longest Substring Without Repeats — Medium
- Most Common Word — Medium