public class FunWithStrings {
	public static void main(String [] args) {
		String s = "Hello";
		System.out.println( '|' + s + '|');	// "Hello"

		s = "J" + s.substring(1);
		System.out.println( '|' + s + '|'); 	// "Jello"
		
		s = s.substring(0, s.length()-1) + "y";
		System.out.println( '|' + s + '|');	// "Jelly"
		
		s += " Belly";
		System.out.println( '|' + s + '|');	 // Jelly Belly
		
		int index = s.indexOf(" ");
		s = "Peanut Butter and " + s.substring(0, index);
		System.out.println( '|' + s + '|');	 // Peanut Butter and Jelly
		
		index = s.indexOf("Jelly");
		s = s.substring(index) + " Roll Morton";
		System.out.println( '|' + s + '|');	 // Jelly Roll Morton
		
		s = s.substring(s.lastIndexOf(" ")+1) + " Salt";
		System.out.println( '|' + s + '|');	 // Morton Salt
		
		index = s.indexOf(" ");
		s = s.substring(0, index) + " Iodized" + s.substring(index); 
		System.out.println( '|' + s + '|');	 // Morton Iodized Salt
	}
}
