summaryrefslogtreecommitdiff
path: root/06/1.lua
blob: 68ea3e2ba5b384517af424ec3b7444982025eb05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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