<p>However, while decoding the message, you realize that there are many different ways you can decode the message because some codes are contained in other codes (<code>"2"</code> and <code>"5"</code> vs <code>"25"</code>).</p>
<p>For example, <code>"11106"</code> can be decoded into:</p>
<li><code>"AAJF"</code> with the grouping <code>(1, 1, 10, 6)</code></li>
<li><code>"KJF"</code> with the grouping <code>(11, 10, 6)</code></li>
<li>The grouping <code>(1, 11, 06)</code> is invalid because <code>"06"</code> is not a valid code (only <code>"6"</code> is valid).</li>
<p>Note: there may be strings that are impossible to decode.<br/>
<br/>
Given a string s containing only digits, return the <strong>number of ways</strong> to <strong>decode</strong> it. If the entire string cannot be decoded in any valid way, return <code>0</code>.</p>
<p>"06" cannot be mapped to "F" because of the leading zero ("6" is different from "06"). In this case, the string is not a valid encoding, so return 0.</p>