AtCoder Regular Contest 153
E
Deque Minimization
AtCoder
⌀ 3276
原题
← DF →
翻译中…

Problem Statement

翻译中…

For a positive integer $X$ none of whose digits is $0$, consider obtaining a positive integer $Y$ as follows.

翻译中…
  • Initialize $S$ as an empty string.
  • Let $N$ be the number of digits in $X$. For $i = 1, \ldots, N$ in this order, do the following: insert the $i$-th character in the decimal notation of $X$ at the beginning or end of $S$.
  • Let $Y$ be the positive integer represented by the string $S$.
翻译中…

Let $f(X)$ denote the minimum positive integer that can be obtained from $X$ in this way.

翻译中…

翻译中…

You are given a positive integer $Y$ none of whose digits is $0$. Print the number, modulo $998244353$, of positive integers $X$ none of whose digits is $0$ such that $f(X) = Y$.

翻译中…

Constraints

翻译中…
  • $Y$ is a positive integer none of whose digits is $0$.
  • $1\leq Y < 10^{200000}$
翻译中…

Input

翻译中…

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

翻译中…

Y

翻译中…

Output

翻译中…

Print the number, modulo $998244353$, of positive integers $X$ none of whose digits is $0$ such that $f(X) = Y$.

翻译中…

样例

Input #1
1332
Output #1
3
Three integers, $1332$, $3132$, and $3312$, satisfy the conditions.
Input #2
3312
Output #2
0
Input #3
12234433442
Output #3
153
题目信息
题号
arc153_e
时间限制
5 s
内存限制
1024 MB

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