#include using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif template struct modular { long long value; modular(long long x = 0) { value = x % mod; if (value < 0) value += mod; } modular& operator+=(const modular& other) { if ((value += other.value) >= mod) value -= mod; return *this; } modular& operator-=(const modular& other) { if ((value -= other.value) < 0) value += mod; return *this; } modular& operator*=(const modular& other) { value = value * other.value % mod; return *this; } modular& operator/=(const modular& other) { long long a = 0, b = 1, c = other.value, m = mod; while (c != 0) { long long t = m / c; m -= t * c; swap(c, m); a -= t * b; swap(a, b); } a %= mod; if (a < 0) a += mod; value = value * a % mod; return *this; } friend modular operator+(const modular& lhs, const modular& rhs) { return modular(lhs) += rhs; } friend modular operator-(const modular& lhs, const modular& rhs) { return modular(lhs) -= rhs; } friend modular operator*(const modular& lhs, const modular& rhs) { return modular(lhs) *= rhs; } friend modular operator/(const modular& lhs, const modular& rhs) { return modular(lhs) /= rhs; } modular& operator++() { return *this += 1; } modular& operator--() { return *this -= 1; } modular operator++(int) { modular res(*this); *this += 1; return res; } modular operator--(int) { modular res(*this); *this -= 1; return res; } modular operator-() const { return modular(-value); } bool operator==(const modular& rhs) const { return value == rhs.value; } bool operator!=(const modular& rhs) const { return value != rhs.value; } bool operator<(const modular& rhs) const { return value < rhs.value; } }; template string to_string(const modular& x) { return to_string(x.value); } template ostream& operator<<(ostream& stream, const modular& x) { return stream << x.value; } template istream& operator>>(istream& stream, modular& x) { stream >> x.value; x.value %= mod; if (x.value < 0) x.value += mod; return stream; } constexpr long long mod = 998244353; using mint = modular; mint power(mint a, long long n) { mint res = 1; while (n > 0) { if (n & 1) { res *= a; } a *= a; n >>= 1; } return res; } vector fact(1, 1); vector finv(1, 1); mint C(int n, int k) { if (n < k || k < 0) { return mint(0); } while ((int) fact.size() < n + 1) { fact.emplace_back(fact.back() * (int) fact.size()); finv.emplace_back(mint(1) / fact.back()); } return fact[n] * finv[k] * finv[n - k]; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, w; cin >> n >> m >> w; string s; cin >> s; int t = 0; mint ans = 0; vector>> dp(27, vector>(27, vector(m + 1))); dp[0][0][0] = 1; for (int i = 0; i < 27; i++) { for (int j = 0; j < 27; j++) { for (int l = 1; l < m + 1; l++) { dp[i][j][l] = dp[i][j][l - 1] * (i + j); if (i) { dp[i][j][l] += dp[i - 1][j][l - 1]; } if (j) { dp[i][j][l] += dp[i][j - 1][l - 1]; } } } } for (int i = 0; i < 27; i++) { for (int j = 0; j < 27; j++) { for (int l = 1; l < m + 1; l++) { dp[i][j][l] += dp[i][j][l - 1]; } } } C(30, 0); for (int i = 0; i < n; i++) { for (int j = 0; j < s[i] - 'a'; j++) { int u = t | (1 << j); u = __builtin_popcount(u); for (int l = 0; l <= 26 - u; l++) { for (int r = 0; r <= u; r++) { if (u + l < w) { continue; } ans += dp[r][l][m - 1 - i] * C(u, r) * fact[r] * C(26 - u, l) * fact[l]; } } // debug(j, ans); } t |= 1 << (s[i] - 'a'); if (__builtin_popcount(t) >= w && i < n - 1) { ans++; } } cout << ans << '\n'; return 0; }