题目
代码
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
char s[N];
int f[N];
int main()
{cin >> s + 1;int n = strlen(s + 1);f[1] = s[1] - 'a' + 1;f[2] = s[2] - 'a' + 1;for (int i = 3; i <= n; i++){f[i] = max(f[i - 2], f[i - 3]) + s[i] - 'a' + 1;}cout << max(f[n], f[n - 1]);
}