A → 1, B → 2, …, Z → 26, and writing the numbers back to back with no separators. That makes many digit strings ambiguous: 25 could be Y or BE.
Given a digit string code, count the ways to split it into letter codes. A code cannot start with zero: 06 is not F. If the string cannot be read at all, return 0.code='2611' → 4
Four readings: 2 6 1 1 (BFAA), 26 1 1 (ZAA), 2 6 11 (BFK), 26 11 (ZK).
code='1203' → 1
A zero can only be the second digit of 10 or 20, so the only reading is 1 20 3 (ATC).
code='30' → 0
30 is not a letter code and 0 alone means nothing, so there are no readings.
code consists of digits only and may start with a zerocode='2611'
4
Run checks the first 3 tests in your browser. Submit checks all 143 tests on the server, hidden ones included.