// #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using lg = long long; using pii = pair; using pll = pair; #define TEST cerr << "TEST" << endl #define AMARI 998244353 // #define AMARI 1000000007 #define TEMOTO ((sizeof(long double) == 16) ? false : true) #define TIME_LIMIT 1980 * (TEMOTO ? 1 : 1000) #define el '\n' #define El '\n' #define mpr make_pair #define MULTI_TEST_CASE false void solve(void) { int n,m,k; cin >> n >> m >> k; string s; cin >> s; vector icutume(n); set tst; for(int i = 0; i < s.size(); i++){ tst.insert(s[i]); icutume[i] = tst.size(); } vector> smaller(m + 1,vector(27,0)),just(m + 1,vector(27,0)); just[0][0] = 1; //配るDP vector visited(26,false); for(int i = 0; i < m; i++){ //just →just if(i < n)just[i + 1][icutume[i]] = 1; for(int j = 0; j <= 26; j++){ //smaller → smaller //if(i == 1 && j == 1)cerr << smaller[i][j] << el; smaller[i + 1][j] += smaller[i][j] * (lg)j; smaller[i + 1][j] %= AMARI; if(j != 26){ smaller[i + 1][j + 1] += smaller[i][j] * (lg)(26 - j); smaller[i + 1][j + 1] %= AMARI; } //just → smaller if(!just[i][j])continue; int tc = 0,fc = 0; if(i >= s.size())continue; //smallerに持ってけるアルファベットが何種類あるか for(int k = 0; k < s[i] - 'a'; k++){ if(visited[k])tc++; else fc++; } visited[s[i] - 'a'] = true; //if(i == 1)cerr << tc << ' ' << fc << el; smaller[i + 1][j] += tc; if(smaller[i + 1][j] > AMARI)smaller[i + 1][j] -= AMARI; if(fc){ smaller[i + 1][j + 1] += fc; if(smaller[i + 1][j + 1] > AMARI)smaller[i + 1][j + 1] -= AMARI; } } } lg ans = 0; if(true){ for(int i = 0; i <= m; i++){ for(int j = 0; j <= 26; j++){ if(j >= k)ans += smaller[i][j]; if(ans > AMARI)ans -= AMARI; //cerr << smaller[i][j] << ' '; //if(i < n && j >= k)ans += just[i][j]; } //cerr << el; } for(int i = 0; i < n - 1; i++)if(icutume[i] >= k)ans++; if(ans > AMARI)ans -= AMARI; } cout << ans << el; return; } void calc(void) { return; } int main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); calc(); int t = 1; if (MULTI_TEST_CASE) cin >> t; while (t--) { solve(); } return 0; }