#include #include using namespace std; using mint = atcoder::modint998244353; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; string s; cin >> n >> s; vector dp(n + 1, vector(2, vector(2))); dp[0][0][0] = 1; for (int i = 0; i < n; i++) { for (int smaller = 0; smaller < 2; smaller++) { for (int j = 0; j < 2; j++) { for (char c = 'a'; c <= (smaller ? 'z' : s[i]); c++) { if (j == 1 && c == 'a') { continue; } int smaller_next = smaller || c < s[i]; int j_next = j || c == 'a'; dp[i + 1][smaller_next][j_next] += dp[i][smaller][j]; } } } } cout << dp[n][1][1].val() << endl; }