Back to the Problem
Build the substitution table from the keyboard string once and map each character.
Complexity: O(|S|)