Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local key = {
- {"A","B","C","D","E"},
- {"F","G","H","I","K"},
- {"L","M","N","O","P"},
- {"Q","R","S","T","U"},
- {"V","W","X","Y","Z"},
- }
- local input = assert(io.open("crypted.txt", "r"), "Failed to open input 'crypted.txt' file")
- local symbol, ch, text = true, nil, ""
- while symbol do
- symbol = input:read(1)
- if tonumber(symbol) then
- if ch then
- text = text .. key[ch][tonumber(symbol)]
- ch = nil
- else
- ch = tonumber(symbol)
- end
- elseif symbol == string.char(32) then
- text = text .. " "
- ch = nil
- elseif symbol == string.char(10) or symbol == string.char(12) then
- text = text .. string.char(10)
- ch = nil
- end
- end
- print(text)
- input:close()
- local output = assert(io.open("result.txt", "w"), "Failed to open output file")
- output:write(text)
- output:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement