Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

Lífið er alltaf fullt af óvissu. Til dæmis gætirðu haldið út frá titli verkefnisins að þetta sé strengjaverkefni, en í raun og veru er það ekki svo.

Þér er gefinn strengur $s$ og stafur $c$. Í hvert skipti velurðu af handahófi staðsetningu $i$ sem hefur ekki verið valin áður, og breytir $s_i$ í $c$ (ef $s_i = c$ telst það samt sem ein aðgerð). Þú endurtekur þessa aðgerð þar til $s$ verður samhverfa (palindrome) og hættir þá. Þú vilt vita væntigildi fjölda aðgerða sem þarf.

Sér í lagi, ef $s$ er nú þegar samhverfa í upphafi, þá er svarið $0$.

Inntak

Fyrsta línan inniheldur streng $s$ ($1 \le |s| \le 250000$), sem tryggt er að samanstandi eingöngu af enskum lágstöfum.

Önnur línan inniheldur enskan lágstaf $c$.

Úttak

Prentaðu eina heiltölu á stakri línu, sem táknar væntigildið modulo $998244353$.

Dæmi

Inntak 1

abcab
a

Úttak 1

4

Inntak 2

abcdcbd
a

Úttak 2

177465668

Inntak 3

aba
z

Úttak 3

0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.