requiring initials using indexOf
<pre><code>Scanner kb = new Scanner(System.in);
     System.out.println("enter name: ");
     String input = kb.nextLine();
     input = " " +input ;

     int first = input.indexOf(' ')+1;
        char firstFinal = input.charAt(first);
     int blank = input.indexOf(' ');
     char name2 = input.charAt(blank);
     String lastName = input.substring(input.lastIndexOf(" ")+1);

     System.out.println(firstFinal + "\n" + name2 +"\n"+ lastName );
</code></pre>

<p>i have acquired the first initial , i am now trying to acquire the middle name(s)
ie. if the user enters Fred John Samuel Smith the program must return FJS Smith .
PS. must use indexOf
Thanks in advance.</p>
