def decode_ways(text):
    if not text:
        return 0
    previous, current = 1, int(text[0] != '0')
    for i in range(2, len(text) + 1):
        ways = current if text[i - 1] != '0' else 0
        if 10 <= int(text[i - 2:i]) <= 26:
            ways += previous
        previous, current = current, ways
    return current
