結果

問題 No.2373 wa, wo, n
ユーザー yabit
提出日時 2023-07-11 09:51:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 82,732 KB
実行使用メモリ 72,368 KB
最終ジャッジ日時 2024-09-13 00:03:59
合計ジャッジ時間 3,434 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(input())
def hantei():
    i = 0
    while i < N:
        if S[i] == 'n':
            i += 1
        elif S[i] == 'w':
            if i == N-1:
                return False
            elif S[i+1] == 'a' or S[i+1] == 'o' or S[i+1] == '?':
                i += 2
            else:
                return False
        elif S[i] == '?':
            if i == N-1:
                i += 1
            elif S[i+1] == 'a' or S[i+1] == 'o':
                i += 2
            else:
                i += 1
        else:
            return False
    return True

if hantei():
    print('Yes')
else:
    print('No')
0