input = {}; for line in io.lines("./input.txt") do table.insert(input, line) end parsed = {}; for key, value in pairs(input) do local alphastrip = string.gsub(value, "[%a]", ""); if string.len(alphastrip) == 1 then local doubled = alphastrip .. alphastrip; table.insert(parsed, doubled); elseif string.len(alphastrip) == 2 then table.insert(parsed, alphastrip); else local digitstrip = string.match(alphastrip, "%d", 1) .. string.match(alphastrip, "%d", -1); table.insert(parsed, digitstrip); --print(digitstrip); end end result = 0; for key, value in pairs(parsed) do result = value + result; end print(result);