結果

問題 No.2373 wa, wo, n
ユーザー lloyz
提出日時 2023-07-07 23:12:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 63,744 KB
最終ジャッジ日時 2024-07-21 19:36:57
合計ジャッジ時間 3,823 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()

i = 0
while i < n:
    if s[i] == '?':
        if i + 1 < n and (s[i + 1] == 'a' or s[i + 1] == 'o'):
            i += 2
        else:
            i += 1
    elif s[i] == 'n':
        i += 1
    elif i + 1 < n and (s[i:i + 2] == 'wa' or s[i:i + 2] == 'wo' or s[i:i + 2] == 'w?'):
        i += 2
    else:
        print("No")
        exit()
print("Yes")
0