問題一覧 > 通常問題

No.1702 count good string

レベル : / AI推定難易度 : 1075 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 149
作問者 : harurun / テスター : first_vil
お気に入りにしたユーザー ProblemId : 6998 / 自分の提出
問題文最終更新日: 2021-09-14 13:07:07
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 317 (順位表) の他の問題:

Problem Statement

You are given a string $S$ of length $N$ consisting of lowercase English letters and ?.

$S$ has $2^{N}-1$ non-empty subsequences. Among them, we define a good subsequence as one that satisfies either of the following conditions.

Conditions

  • The subsequence does not contain ?

  • The subsequence contains exactly one ?

Here, let $T$ be the set of strings obtained by choosing at most one character of the string yukicoder and replacing it with ?.

Find the number of good subsequences that are contained in $T$, modulo $10^9+7$.

Input

$N$
$S$
  • The first line contains an integer $N$.

  • The second line contains a string $S$.

Constraints

  • $1≤N≤10^5$

  • $N$ is an integer.

  • $|S|=N$

  • $S$ consists of lowercase English letters or ?.

Output

Print the answer on one line.

Print a newline at the end.

Sample

Sample 1
Input
9
yukicoder
Output
1

Sample 2
Input
7
harurun
Output
0

Sample 3
Input
14
yukiyuki?coder
Output
14

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