require("ext") local line = io.read("*a") local buf = {} for i = 1,14 do table.insert(buf, line:sub(i,i)) end function checkbuf() local s,u = {},0 for _,v in pairs(buf) do if not s[v] then s[v] = true u = u + 1 end end if u == 14 then return true end end if checkbuf() then print(14) end for i = 15,#line do table.remove(buf,1) table.insert(buf,line:sub(i,i)) if checkbuf() then print(i) break end end