LogiQuest

118. Decode Ways

MediumDynamic Programming

Letters are encoded as A → 1, B → 2, …, Z → 26. Count the ways to decode the digit string. Print the count modulo 10⁹ + 7.

Input format

A single line of digits.

Output format

The number of decodings mod 10⁹ + 7.

Example 1

Input

12

Output

2

Example 2

Input

226

Output

3

Constraints

1 ≤ |s| ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…