1L = list(input())
2N = len(L)
3MOD = 10**6
4
5def solution():
6 if L[0] == '0':
7 return 0
8
9 dp = [1, 1]+[0]*(N-1)
10
11 for i in range(2, N+1):
12 if L[i-1] != '0':
13 dp[i] = (dp[i]+dp[i-1]) % MOD
14 if 10 <= int(L[i-2]+L[i-1]) <= 26:
15 dp[i] = (dp[i]+dp[i-2]) % MOD
16
17 return dp[N]
18
19
20print (solution())
- 인터넷을 참고하여 풀었다