Given a string s containing only digits, return the number of ways to decode it where 'A' -> 1, 'B' -> 2, ..., 'Z' -> 26. Pattern focus: Decode ways. Each position depends on whether the previous one or two digits form a valid letter.
s = digit string
number of valid decodings
Example 1:
Input:
s = "12"
Output:
2
Explanation:
12 can be decoded as AB or L.
Example 2:
Input:
s = "226"
Output:
3
Explanation:
The valid decodings are BZ, VF, and BBF.