結果
| 問題 | No.2373 wa, wo, n | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-07-08 08:20:51 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 720 bytes | 
| コンパイル時間 | 209 ms | 
| コンパイル使用メモリ | 81,920 KB | 
| 実行使用メモリ | 266,368 KB | 
| 最終ジャッジ日時 | 2024-07-22 04:11:36 | 
| 合計ジャッジ時間 | 11,612 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 34 RE * 1 TLE * 4 | 
ソースコード
def solve(N, S):
    candidate = ["wa", "wo", "n"]
    while True:
        if len(S) == 0:
            break
        if S[0] == '?' and len(S) == 1:
            S = []
            break
        if S[0] == '?' and S[1] == '?':
            S = S[1:]
            continue
        match = False
        for cc in candidate:
            match = True
            for i in range(len(cc)):
                if S[i] != '?' and S[i] != cc[i]:
                    match = False
                    break
            if match:
                S = S[len(cc):]
                break
        if not match:
            break
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
N = int(input())
S = input()
solve(N, S)
            
            
            
        