Problem9337--ABC299 —— F - Square Subsequence

9337: ABC299 —— F - Square Subsequence

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

### Problem Statement

You are given a string $S$ consisting of lowercase English letters. Print the number of non-empty strings $T$ that satisfy the following condition, modulo $998244353$.

> The concatenation $TT$ of two copies of $T$ is a subsequence of $S$ (not necessarily contiguous).

Input

### Constraints

-   $S$ is a string consisting of lowercase English letters whose length is between $1$ and $100$, inclusive.

Output

### Input

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

```
$S$
```

Constraints

### Output

Print the answer.

Sample 1 Input

ababbaba

Sample 1 Output

8
The eight strings satisfying the condition are a, aa, ab, aba, b, ba, bab, and bb.

Sample 2 Input

zzz

Sample 2 Output

1
The only string satisfying the condition is z. Note that this string contributes to the answer just once, although there are three ways to extract the subsequence zz from $S=S_1S_2S_3= zzz: S_1S_2= zz, S_1S_3= zz$, and $S_2S_3= zz$.

Sample 3 Input

ppppqqppqqqpqpqppqpqqqqpppqppq

Sample 3 Output

580

Source/Category