a = input() dp = [0,0,0] for i in range(len(a)): if int(a[i]) % 3 == 0: dp = [e * 2 for e in dp] dp[0] += 1 if int(a[i]) % 3 == 1: temp = dp[:] dp[1] += temp[0] dp[2] += temp[1] dp[0] += temp[2] dp[1] += 1 if int(a[i]) % 3 == 2: ...