Printing the number of ways a message can be decoded
Your code performs one recursion per character and recursion depth is limited. For long inputs, your code will raise RecursionError: maximum recursion depth exceeded. Replacing recursion with an explicit loop solves the issue.

Also, if you start the calculation at k = 1 with memo[-1] and memo[0] properly initialized and then work upwards to k = len(s), the code will become significantly simpler. When calculating memo[k], you only ever access memo[k-2] and memo[k-1], so you can store only those. I renamed them old and new. Here is how it could look like:

def num_ways_dp(s):
    old = new = 1
    for i in range(len(s)-1):
        if int(s[i:i+2]) &gt; 26: old = 0 # no two-digit solutions
        if int(s[i+1]) == '0': new = 0 # no one-digit solutions
        (old, new) = (new, old + new)
    return new

if __name__ == '__main__':
    number = input()
    while number != '0':
        print(num_ways_dp(number))
        number = input()