Logo
(追記) (追記ここまで)

18923번 - Embeddings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB51311961.290%

문제

Given a string $A$ of length $n$. Consider palindromic substrings of this string. Each palindromic substring is defined by its starting position $s$ and its end $e$ (1ドル \le s \le e \le n$) such that letters in $A$ starting at position $s$ and ending at position $e,ドル inclusive, form a palindrome (i.e. $A[s+i]=A[e-i]$ for any integer $i$ between 0 and $e-s,ドル inclusive).

Let's define an embedding of depth $k \ge 1$ as a sequence of $k$ palindromic substrings of $A$ with the following property: $s_1 < \ldots < s_k$ and $e_1 > \ldots > e_k,ドル i.e. palindromes in the embedding are strictly contained in each other like the Russian dolls.

Given $A,ドル count the number of possible embeddings. Since this number can be too large, calculate it modulo 998ドル,244円,353円$.

입력

The input consists of a single line containing the string $A$. The string is non-empty and consists of no more than 10ドル^6$ lowercase English letters.

출력

Print the number of possible embeddings modulo 998ドル,244円,353円$.

제한

예제 입력 1

bonobo

예제 출력 1

16

예제 입력 2

banana

예제 출력 2

18

힌트

For the sample input 1, we have nine embeddings of depth 1 (1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 2-4, 4-6, 1-5), six embeddings of depth 2 (3-3 in 2-4, 5-5 in 4-6, 2-2 in 1-5, 3-3 in 1-5, 4-4 in 1-5, 2-4 in 1-5), and one embedding of depth 3 (3-3 in 2-4 in 1-5), with 9ドル+6+1=16$ embeddings in total.

출처

Camp > Bytedance-Moscow Workshops Camp > Bytedance-Moscow Workshops Camp 2020 > Contest 1 E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /