lines = File.readlines("text.txt")line_count = lines.sizetext = lines.joinputs "#{line_count} lines"total_characters_nospaces = text.gsub(/\s+/, '').lengthputs "#{total_characters_nospaces} characters excluding spaces"