local s = io.read() local function checkCommon(last, word) local isok = false last = last:lower() if 6 < #last then last = last:sub(#last - 5, #last) end if 3 <= #last then local pos = last:find(word) if pos and 1 <= pos then local tmp = true for i = pos + 3, #last do local num = last:sub(i, i):byte() if 97 <= num and num <= 122 then tmp = false end end isok = tmp end end return isok end while s do local accept = false local cur = "" local sep = {} for i = 1, #s do local ss = s:sub(i, i) if ss == " " then table.insert(sep, cur) cur = "" else cur = cur .. ss end end if cur ~= "" then table.insert(sep, cur) end local last = sep[#sep] if sep[1] == "digi" then accept = checkCommon(last, "nyo") elseif sep[1] == "petit" then accept = checkCommon(last, "nyu") elseif sep[1] == "rabi" then local found = false for i = 2, #sep do local w = sep[i]:lower() for j = 1, #w do if 97 <= w and w <= 122 then found = true end end end accept = found elseif sep[1] == "gema" then accept = checkCommon(last, "gema") elseif sep[1] == "piyo" then accept = checkCommon(last, "pyo") end print(accept and "CORRECT (maybe)" or "WRONG!") s = io.read() end