問題一覧 > 通常問題

No.2373 wa, wo, n

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 180
作問者 : nwo / テスター : KowerKoint2010 hibit_at MM poyon
お気に入りにしたユーザー ProblemId : 9694 / 自分の提出
問題文最終更新日: 2023-07-07 08:48:27
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 396 (Asakatsu Presents 2) (順位表) の他の問題:

Problem Statement

Story

Hibit burned his mouth on his early morning coffee.

As a result, between $7$:$30$ and $8$:$30$, while the virtual contest "Asakatsu" is being held, he can only pronounce "wa, wo, n".

Hibit wants to read the problem statements aloud while participating in Asakatsu. Can he read a problem statement out loud exactly, with nothing missing and nothing extra?


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

Determine whether $S$ can be made into a wawon string by independently replacing each ? in $S$ with a lowercase English letter.
Here, a wawon string is a string defined as follows.

  • A string obtained by starting with an empty string $T$ and repeating the operation of appending one of wa, wo, n to the end of $T$ at least $1$ time.

For example, nwo and wanwawan are wawon strings, while nwao and asakatsu are not wawon strings.

Input

$N$
$S$

  • $1\leq N\leq 2\times10^5$
  • $N$ is an integer.
  • $S$ is a string of length $N$ consisting of lowercase English letters and ?.
  • Output

    Print Yes if $S$ can be made into a wawon string, and No otherwise.

    Sample

    Sample 1
    Input
    3
    w?n
    Output
    Yes

    For example, by replacing the ? at the $2$nd character with a, $S$ becomes wan.

    Since wan is a wawon string, print Yes.

    Sample 2
    Input
    3
    w?a
    Output
    No

    No matter how the ? is replaced, $S$ cannot be made into a wawon string, so print No.

    Sample 3
    Input
    5
    ?o?on
    Output
    Yes

    Sample 4
    Input
    10
    ?owe??o?n?
    Output
    No

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