title: Reverse every word in a string and capitalize the start of the word
body: <p>Sample input:</p>
  
  <pre><code>abc def ghi
  </code></pre>
  
  <p>Sample output:</p>
  
  <pre><code>Cba Fed Ihg
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>import java.util.Stack;
  
  public class StringRev {
      static String output1 = new String();
      static Stack&lt;Character&gt; stack = new Stack&lt;Character&gt;();
      public static void ReverseString(String input) {
          input = input + " ";
          for (int i = 0; i &lt; input.length(); i++) {
              boolean cap = true;
              if (input.charAt(i) == ' ') {
                  while (!stack.isEmpty()) {
                      if (cap) {
                          char c = stack.pop().charValue();
                          c = Character.toUpperCase(c);
                          output1 = output1 + c;
                          cap = false;
                      } else
                          output1 = output1 + stack.pop().charValue();
                  }
                  output1 += " ";
              } else {
                  stack.push(input.charAt(i));
              }
          }
          System.out.print(output1);
      }
  }
  </code></pre>
  
  <p>Any better solutions?</p>