Enter Your Name :
google
g
go
goo
goog
googl
google
googl
goog
goo
go
g
BUILD SUCCESSFUL (total time: 9 seconds)
Program : (Source Code)
//According to NetBeans Software
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.io.*;
/**
*
* @author STMARYS
*/
public class JavaApplication1 {
/**
* @param args
* @pargam args the command line arguments
* @throws java.io.IOException
*/
public static void main(String[] args) throws IOException {
// TODO code application logic here
InputStreamReader reader=new InputStreamReader(System.in);
BufferedReader input=new BufferedReader(reader);
System.out.println(“Enter Your Name :”);
String s1=input.readLine();
int i=s1.length();
for(int r=0;r<=i-1;r++)
{
for(int j=0;j<=r;j++)
{
System.out.print(s1.charAt(j)+””);
}
System.out.println();
}
for(int r=i-1;r>=0;r–)
{
for(int j=0;j<=r-1;j++)
{
System.out.print(s1.charAt(j)+””);
}
System.out.println();
}
}
}