#!./lua.sh

io.input"list.txt"
io.output"nodup.txt"

local out = io.write

for l in io.lines() do
    local seen = {}
    local a,b = l:match"(.-;.-;.-;)(.*)"
    out(a)

    for f in b:gmatch".-;" do
        if seen[f] then
            out";"
        else
            out(f)
            seen[f] = true
        end
    end
    out"\n"
end
