Decode Ways

00:00
MediumDynamic ProgrammingString
AmazonFacebook

Given a string of digits, count ways to decode it where 'A'=1...'Z'=26. Each 1-2 digit sequence maps to a letter.

Examples

Input → '12'
Output → 2
Note: 'AB' or 'L'
Input → '226'
Output → 3
Note: 'BZ','VF','BBF'
Input → '06'
Output → 0
Note: leading zero in '06' is invalid