| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 8 초 | 2048 MB | 14 | 2 | 2 | 40.000% |
You are given a non-empty string $s$ of lowercase English letters. A string $w$ of lowercase English letters is good 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 7 aaaaaa
25
3 5 aba
675