結果

問題 No.2373 wa, wo, n
ユーザー prd_xxx
提出日時 2023-07-07 21:56:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 679 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 76,176 KB
最終ジャッジ日時 2024-07-21 17:50:40
合計ジャッジ時間 3,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 12 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
for c in S:
    if c not in 'waon?':
        exit(print('No'))

T = S.replace('n','').replace('wa','').replace('wo','')
if T=='':
    exit(print('Yes'))

T = T.replace('o','a')
assert all(c in 'wa?' for c in T)

if len(T) == 1:
    exit(print('Yes' if T=='?' else 'No'))
print(T)
buf = ''
for c in T:
    if c == 'w':
        if buf=='w' or buf=='a':
            exit(print('No'))
        buf = 'w'
    elif c == 'a':
        if buf=='a' or buf=='':
            exit(print('No'))
        buf = ''
    else:
        if buf=='w':
            buf = ''
        elif buf=='a':
            exit(print('No'))
        else:
            buf = '?'
print('Yes')
0