시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
8 초 | 2048 MB | 1 | 1 | 1 | 100.000% |
You are given a non-empty string $s$ of lowercase English letters. A string $w$ of lowercase English letters isgood if every proper prefix of $w$ does not contain $s$ as a substring, but $w$ itself does.
Find the number of good strings of length $m$. Because this number can be very large, output it modulo prime number $998\,244\,353 = 2^{23} \cdot 119 + 1$.
The first line of the input contains two integers: $n$, the length of $s$, and $m$, the length of strings you have to count ($1 \leq n \leq 10^5$, $n \leq m \leq 10^9$). The second line contains a string $s$ consisting of $n$ lowercase English letters.
Output a single nonnegative integer: the number of good strings of length $m$ modulo $998\,244\,353$.
6 7aaaaaa
25
3 5aba
675