bytes = File.open('reversed.txt', &:read).bytes
chars = bytes.reverse.join.chars
output = ''
while chars.length > 1
 chunk = chars[0..2].join.to_i
 if chunk < 300
   print chunk.chr
   chars.shift(3)
 else
   print chars.shift(2).join.to_i.chr
 end
end