diff options
Diffstat (limited to '06/1.lua')
| -rw-r--r-- | 06/1.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/06/1.lua b/06/1.lua new file mode 100644 index 0000000..68ea3e2 --- /dev/null +++ b/06/1.lua @@ -0,0 +1,28 @@ +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 |
