title: How do I capitalize the first letter of each word in a string?
body: <p>Expected result:</p>
  
  <pre><code>input = "heLlo wOrLd"
  output= "Hello World"
  </code></pre>
  
  <p>Actual result:</p>
  
  <pre><code>output= "Hello world"
  </code></pre>
  
  <p>My code only capitalizes the first word of the sentence:</p>
  
  <pre><code>public static void main(String args[]) {
      String input = "heLlo wOrLd";
  
      String output = input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase();
  
      System.out.println(output);
  }
  </code></pre>