No.2373 wa, wo, n
タグ : / 解いたユーザー数 180
作問者 :
KowerKoint2010
hibit_at
MM
poyon
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,nto 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$
?.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もしくは右上の雲マークをクリックしてアカウントを作成してください。