結果

問題 No.342 一番ワロタww
ユーザー 👑 obakyan
提出日時 2019-04-30 15:24:23
言語 Lua
(LuaJit 2.1.1734355927)
結果
WA  
実行時間 -
コード長 1,098 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 02:39:49
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 3 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

-- "w" = 130 151
local str = io.read()
local t = {}
for i = 1, #str do
  t[i] = str:sub(i, i):byte()
end
local chain = 0
local stpos, edpos = 1
local i = 1
local wlist = {}
local maxchain = 0
while(i < #str) do
  if(t[i] == 130 and t[i + 1] == 151) then
    if(chain == 0) then
      edpos = i - 1
    end
    chain = chain + 1
    i = i + 2
  else
    if(0 < chain) then
      local len = edpos - stpos + 1
      if(0 < len) then
        maxchain = math.max(chain, chain)
        if(wlist[chain] == nil) then wlist[chain] = {} end
        local tmp = {}
        tmp.st = stpos
        tmp.ed = edpos
        table.insert(wlist[chain], tmp)
      end
      stpos = i
      chain = 0
    end
    i = i + 1
  end
end
if(0 < chain) then
  local len = edpos - stpos + 1
  if(0 < len) then
    maxchain = math.max(chain, chain)
    if(wlist[chain] == nil) then wlist[chain] = {} end
    local tmp = {}
    tmp.st = stpos
    tmp.ed = edpos
    table.insert(wlist[chain], tmp)
  end
end
if(maxchain == 0) then print("")
else
  for k, v in pairs(wlist[maxchain]) do
  print(str:sub(v.st, v.ed))
  end
end
0