def titleize(string) nocaps = ["the","and"] puts string.split(" ").map { |word| nocaps.include?(word) ? word : word.capitalize }.join(