title: Printing a String in pyramid Form
body: <p>I like to print a string that is got as an input from the user in a Pyramid form letter by letter.
  For example - When a user gives an input as "string" then the output should be:</p>
  
  <pre><code>     s
      s t
     s t r
    s t r i
   s t r i n
  s t r i n g
  </code></pre>
  
  <p>I've tried a small program but it doesn't arranges the words in Pyramid form. The program is</p>
  
  <pre><code>    import java.io.*;
      import java.util.Scanner;
      import java.lang.String;
  
      public class Mainer {
      public static void main(String args[]){
         try
         {
             Scanner sc = new Scanner(System.in);
             String s;
             int l;
             System.out.println("Enter the String : ");
             s = sc.nextLine();
             l = s.length();
             for(int i=0; i&lt;l;i++)
             {
  
                 for(int j=0;j&lt;i;j++)
                 {
                     System.out.printf("%c ",s.charAt(j));
                 }
                 System.out.printf("%c\n",s.charAt(i));
             }         
  
         }
         catch(Exception e)
         {
             System.err.println(e);
         }
      }
  }
  </code></pre>
  
  <p>And the output of the above program is(when string is given as input)
  Enter the String : 
  string</p>
  
  <pre><code>s
  s t
  s t r
  s t r i
  s t r i n
  s t r i n g
  </code></pre>
  
  <p>Can you make it arranged as the first example?</p>