title: Reverse each word of user given string without altering their position
body: <p>I need a little help. I found a question like <strong>"Write a Java program that will reverse each word of user given string without altering their position and using any built in function."</strong>  </p>
  
  <p>I solved a code for reversing the whole sentence, but I don't  know how to solve this one. Please help me...</p>
  
  <pre><code>import java.io.*;
  class test25 { 
      public static void main(String args[]) throws IOException { 
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          System.out.print("Enter string: ");
          String s = br.readLine();
          String reverse = "";
          int length = s.length();
  
          for (int i = length - 1; i &gt;= 0; i--)
              reverse = reverse + s.charAt(i);
          System.out.println("Result:" + reverse); 
      } 
  }
  </code></pre>