結果

問題 No.2373 wa, wo, n
ユーザー nouka28nouka28
提出日時 2023-07-07 21:39:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 85,524 KB
最終ジャッジ日時 2024-07-21 17:25:10
合計ジャッジ時間 4,185 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

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