// StringInShrinkingPieces.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-15 File created. // 2006-02-15 Last modification. // A solutions to Exercise 8-8. import java.util.* ; class StringInShrinkingPieces { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; System.out.print( "\n Please, type in a string. \n\n " ) ; String given_string = keyboard.nextLine() ; System.out.print( "\n The given String in shrinking pieces: \n" ) ; for ( int character_index = 0 ; character_index < given_string.length() ; character_index ++ ) { String substring_of_given_string = given_string.substring( character_index ) ; System.out.print( "\n " + substring_of_given_string ) ; } } }