【2019校招真题】解码方法(python)
解码方法_牛客网
https://www.nowcoder.com/practice/b83b126603dd4e63bc4287d32d754886?tpId=98&tqId=32868&tPage=3&rp=3&ru=/ta/2019test&qru=/ta/2019test/question-ranking
完整代码
s = input() n = len(s) x_1 = 1 for i in range(n): if i == 0: x_2 = 1 else: if int(s[i - 1: i + 1]) <= 26: x_1, x_2 = x_2, x_1 + x_2 else: x_1 = x_2 print(x_2)