file = io.open("input") io.input(file) score = 0 data = {} for line in file:lines() do table.insert(data, line) end for i = 1, #data/3 do local one = data[(i-1)*3+1] local two = data[(i-1)*3+2] local three = data[(i-1)*3+3] for n = 1, #one do local char = string.sub(one, n, n) if string.match(two, char) and string.match(three, char) then if char == string.upper(char) then score = score + string.byte(char) - string.byte("A") + 27 goto continue elseif char == string.lower(char) then score = score + string.byte(char) - string.byte("a") + 1 goto continue end end end ::continue:: end print(score)