aboutsummaryrefslogtreecommitdiff
path: root/challenge-127/abigail/lua/ch-1.lua
blob: 517e884e6ccfe2c7175432a8bfc7275677279b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/opt/local/bin/lua

--
-- See ../README.md
--

--
-- Run as: lua ch-1.lua < input-file
--

for line in io . lines () do
    local seen = {}
    local out  = 1
    for number in line : gmatch ("([-+]?[0-9]+)") do
        if seen [number] then
            out = 0  -- We have a duplicate
        else
            seen [number] = 1
        end
    end
    print (out)
end