# Input "" should return 1 instead of 0

• There is 1 way to decoding "", the decoding result is "".

• Agree. For those abnormal input, also need to return 0, like '2002', '0123' and '3021'

• Agree. I guess they will put these abnormal cases into the judge cases.

• Disagree.
The question's following mapping is:

'A' -> 1
'B' -> 2
...
'Z' -> 26

There is no "" in it.

So, "" is also abnormal input, which need to return 0, like '2002', '0123' and '3021'

• I think the reason they didn't care about abnormal input is this:

"Given an encoded message containing digits", no letter indicates "0",

So there is no way you can encode a message to: "2002" or "0123"

• @JellyDG But actually, "0" is one of their test cases.

• The task is

Given an encoded message containing digits, determine the total number of ways to decode it.

So the input string MUST BE a valid encoded message. Otherwise the task could be formulated like this:

Given a string (containing digits), determine the total number of ways to decode it, or return 0 if it is not a valid encoded message.

• @YongHaoHu We can say the only way to decode "" is "" (just like the only way to decode "51" is "5|1" and the only two ways to decode "171" are "17|1" and "1|7|1"). So I agree that returning 1 instead of 0 would be more logically and mathematically consistent.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.