結果

問題 No.2373 wa, wo, n
ユーザー ryohei22
提出日時 2023-07-07 22:03:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 65,152 KB
最終ジャッジ日時 2024-07-21 18:05:31
合計ジャッジ時間 3,488 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

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

i = 0
while i < N:
    if S[i] == 'n':
        i += 1
    elif S[i] == 'w':
        if i == N - 1 or S[i+1] not in ['a', 'o' ,'?']:
            print('No')
            exit()
        else:
            i += 2
    elif S[i] == '?':
        if i != N - 1 and S[i+1] in ['a', 'o']:
            i += 2
        else:
            i += 1
    else:
        print('No')
        exit()
print('Yes')
0