A message of letters A-Z is represented as numbers: , , ..., . Given a string of digits like "", count how many ways you can decode it. "" can be "BZ" (,), "VF" (,), or "BBF" (,,).
That's ways. Before reading on, think: at each position, what choices do you have? And when is a choice invalid? Constraints: . Watch for leading zeros: '06' is not a valid encoding.