> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0091_decode_ways/slt.md).

# Solution 1 dp

dp\[i]表示长度为i的str的可能解码方式。这里我们dp的总长度是`str.size()+1`。dp\[0]存放1。不表示0长度的解码种数，只是为了后面的计算

以12345为例，第二行是dp对应的元素。可见当前s\[i]在1到9之间时，解码的数量和dp\[i-1]持平。但是substr(i-2,2)在10到26之间时，dp\[i]还要加dp\[i-2];

注意i是长度 dp\[i] += dp\[i-1] s\[i-1]是1-9的数 dp\[i] += dp\[i-2] s\[i-2:i]是10到26的数

```
 12345
112333
```

注意处理0开头的特殊情况
