시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 15 | 12 | 11 | 91.667% |
CauchySheep has a string s.
He looked at all its different non-empty substrings and added a directed edge from a to b if |b| + 1 = |a| and b is a substring of a.
You need to calculate the number of simple paths starting from s in this graph, modulo 998 244 353.
The first line of the input contains a string s consisting of lowercase Latin letters: the string CauchySheep has (1 ≤ |s| ≤ 300 000).
Output one integer: the number of simple paths starting from s in CauchySheep’s graph, modulo 998 244 353.
abba
13
benbeipo
255
iqiiiiiiqq
300
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
35
Camp > Petrozavodsk Programming Camp > Summer 2019 > Day 2: 300iq Contest 2 G번
Contest > Open Cup > 2019/2020 Season > Stage 1: Grand Prix of Kazan G번