Square Subsequence

AtCoder
IDabc299_f
Time2000ms
Memory256MB
Difficulty
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). ## Constraints * $S$ is a string consisting of lowercase English letters whose length is between $1$ and $100$, inclusive. ## Input The input is given from Standard Input in the following format: $S$ [samples]
Samples
Input #1
ababbaba
Output #1
8

The eight strings satisfying the condition are `a`, `aa`, `ab`, `aba`, `b`, `ba`, `bab`, and `bb`.
Input #2
zzz
Output #2
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`.
Input #3
ppppqqppqqqpqpqppqpqqqqpppqppq
Output #3
580
API Response (JSON)
{
  "problem": {
    "name": "Square Subsequence",
    "description": {
      "content": "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",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc299_f"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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$.\n\n> The concatenation $TT$ of two...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments