ユニークビジョンプログラミングコンテスト2025 秋(AtCoder Beginner Contest 425)
F
Inserting Process
AtCoder
⌀ 1831
原题
←G →
翻译中…

Problem Statement

翻译中…

You are given a string $T$ of length $N$ consisting of lowercase English letters.

翻译中…

Output, modulo $998244353$, the number of sequences of strings $s=(s_0,s_1,\ldots,s_N)$ that satisfy all of the following conditions.

翻译中…
  • $s_0$ is an empty string.
  • For $i=1,2,\ldots,N$, the string $s_{i}$ is obtained by inserting one arbitrary character at an arbitrary position (possibly beginning or end) in $s_{i-1}$.
  • $s_N=T$
翻译中…

Constraints

翻译中…
  • $1\leq N\leq 22$
  • $N$ is an integer.
  • $T$ is a string of length $N$ consisting of lowercase English letters.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
T

翻译中…

Output

翻译中…

Output the answer.

翻译中…

样例

Input #1
3
aab
Output #1
3
The sequences $s$ that satisfy the conditions are the following three: - $s=(\texttt{""}, \texttt{"a"} ,\texttt{"aa"} ,\texttt{"aab"} )$ - $s=(\texttt{""}, \texttt{"a"} ,\texttt{"ab"} ,\texttt{"aab"} )$ - $s=(\texttt{""}, \texttt{"b"} ,\texttt{"ab"} ,\texttt{"aab"} )$
Input #2
7
atcoder
Output #2
5040
Input #3
22
atcoderbeginnercontest
Output #3
115732070
题目信息

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。