問題一覧 > 通常問題

No.1740 Alone 'a'

レベル : / AI推定難易度 : 1025 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 145
作問者 : Shirotsume / テスター : nok0 👑 Kazun
お気に入りにしたユーザー ProblemId : 7164 / 自分の提出
問題文最終更新日: 2021-10-28 09:39:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 322 (順位表) の他の問題:

Problem Statement

You are given a string $S$ of length $N$ consisting only of lowercase English letters. Find the number, modulo $998244353$, of strings consisting only of lowercase English letters that satisfy all of the following conditions.

  • The length is exactly $N$.
  • It comes before $S$ in lexicographical order.
  • It contains exactly $1$ a.

Constraints

  • $1 \leq N \leq 2 \times 10^5$
  • $N$ is an integer
  • $S$ is a string consisting of lowercase English letters
  • $|S|=N$

Input

The input is given from standard input in the following format.
$N$
$S$

Output

Output the answer. Print a newline at the end.

Sample

Sample 1
Input
3
abd
Output
2

Among the strings of length $3$ that come before abd in lexicographical order, those containing exactly $1$ a are the $2$ strings abb and abc.

Sample 2
Input
2
zz
Output
50

Sample 3
Input
9
yukicoder
Output
316587228

Output the remainder when divided by $998244353$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。