結果
| 問題 | No.2373 wa, wo, n | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2023-07-15 22:05:34 | 
| 言語 | Lua (LuaJit 2.1.1734355927) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 9 ms / 2,000 ms | 
| コード長 | 551 bytes | 
| コンパイル時間 | 88 ms | 
| コンパイル使用メモリ | 5,120 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-17 06:50:22 | 
| 合計ジャッジ時間 | 1,534 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 39 | 
ソースコード
local n = io.read("*n", "*l")
local s = io.read()
-- w, aon
local a1, a2 = false, true
for i = 1, n do
  local t1, t2 = false, false
  local b = s:sub(i, i)
  if b == "w" then
    if a2 then
      t1 = true
    end
  elseif b == "a" or b == "o" then
    if a1 then
      t2 = true
    end
  elseif b == "n" then
    if a2 then
      t2 = true
    end
  elseif b == "?" then
    if a1 then
      t2 = true
    end
    if a2 then
      t1, t2 = true, true
    end
  else
    print("No") os.exit()
  end
  a1, a2 = t1, t2
end
print(a2 and "Yes" or "No")
            
            
            
        