結果

問題 No.2373 wa, wo, n
ユーザー meruuu61779999
提出日時 2023-07-07 21:50:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,660 KB
最終ジャッジ日時 2024-07-21 17:41:17
合計ジャッジ時間 4,073 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
S = input()

que = deque()
for s in S:
    que.append(s)

while que:
    el = que.popleft()
    if el == 'n':
        continue
    if el == 'w':
        if que and que[0] in ('?', 'a', 'o'):
            que.popleft()
            continue
        else:
            print("No")
            exit()
    if el == '?':
        if que and que[0] in ('a', 'o'):
            que.popleft()
        continue
    print("No")
    exit()
print("Yes")
0