AtCoder Grand Contest 020
E
Encoding Subsets
AtCoder
⌀ 2944
原题
← DF →
翻译中…

Problem Statement

翻译中…

Consider the following set of rules for encoding strings consisting of 0 and 1:

翻译中…
  • Strings 0 and 1 can be encoded as 0 and 1, respectively.
  • If strings $A$ and $B$ can be encoded as $P$ and $Q$, respectively, then string $AB$ can be encoded as $PQ$.
  • If string $A$ can be encoded as $P$ and $K \geq 2$ is a positive integer, then string $AA...A$ ($A$ repeated $K$ times) can be encoded as ($P$x$K$).
翻译中…

For example, string 001001001, among other possibilities, can be encoded as 001001001, 00(1(0x2)x2)1 and (001x3).

翻译中…

Let's call string $A$ a subset of string $B$ if:

翻译中…
  • $A$ and $B$ are equal in length and consist of 0 and 1;
  • for all indices $i$ such that $A_i$ = 1, it's also true that $B_i$ = 1.
翻译中…

You are given string $S$ consisting of 0 and 1. Find the total number of distinct encodings of all subsets of $S$, modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $1 \leq |S| \leq 100$
  • $S$ consists of 0 and 1.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S

翻译中…

Output

翻译中…

Print the total number of distinct encodings of all subsets of $S$ modulo $998244353$.

翻译中…

样例

Input #1
011
Output #1
9
There are four subsets of $S$: - `011` can be encoded as `011` and `0(1x2)`; - `010` can be encoded as `010`; - `001` can be encoded as `001` and `(0x2)1`; - `000` can be encoded as `000`, `0(0x2)`, `(0x2)0` and `(0x3)`. Thus, the total number of encodings of all subsets of $S$ is $2 + 1 + 2 + 4 = 9$.
Input #2
0000
Output #2
10
This time $S$ has only one subset, but it can be encoded in $10$ different ways.
Input #3
101110
Output #3
156
Input #4
001110111010110001100000100111
Output #4
363383189
Don't forget to take the result modulo $998244353$.
题目信息
题号
agc020_e
时间限制
5 s
内存限制
512 MB

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