#include #include #define MOD 998244353 using namespace std; constexpr unsigned int pow_mod(const unsigned long long a, const unsigned long long b, const unsigned int mod) { return (b == 0 ? (mod == 1 ? 0 : 1) : (b & 1 ? a % mod : 1) * pow_mod((a % mod) * (a % mod) % mod, b >> 1, mod) % mod); } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint32_t N, K, i, count = 0, ans = 0, temp; cin >> N >> K; string S; S.reserve(N), cin >> S; if (S[0] == 'N') ++count; for (i = 1; i != N; ++i) if (S[i] == 'N') { if (S[i - 1] == 'C') { if (K != 0) --K; } else ++count; } if (count < K) cout << "0\n"; else { temp = count; for (i = 1; i <= count - K; ++i) ans = (ans + temp) % MOD, temp = temp * static_cast(count - i) % MOD * pow_mod(i + 1, MOD - 2, MOD) % MOD; cout << ans << '\n'; } return 0; }