結果

問題 No.2373 wa, wo, n
コンテスト
ユーザー nouka28
提出日時 2023-07-07 21:39:34
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 420 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 209 ms
コンパイル使用メモリ 85,456 KB
実行使用メモリ 90,040 KB
最終ジャッジ日時 2026-04-03 05:27:12
合計ジャッジ時間 3,959 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
s=list(input())
s.reverse()
while len(s):
    if len(s)>1 and ("".join(s[len(s)-2:])=="aw" or "".join(s[len(s)-2:])=="ow" or "".join(s[len(s)-2:])=="?w"):
        for i in range(2):s.pop()
    elif s[-1]=="n":s.pop()
    elif s[-1]=="?":
        if len(s)>1 and (s[-2]=="o"or s[-2]=="a"):
            for i in range(2):s.pop()
        else:s.pop()
    else:
        print("No")
        exit()
print("Yes")
0