Created
December 24, 2016 04:07
-
-
Save gotoark/90fe4d3c1409df1756254e76223d7cbe to your computer and use it in GitHub Desktop.
String Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class StringCombination { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Scanner scan= new Scanner(System.in); | |
String name=new String(); | |
name=scan.next(); | |
int iterations=0,n,s,e; | |
e=1; //Initialize word count | |
for(int i=name.length();i>=0;i--){ | |
n=i; | |
s=0; | |
while(n>0){ | |
System.out.println(name.substring(s,s+e)); | |
s++; | |
n--; | |
} | |
e++; | |
//end of for | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Input: GITHUB
OUTPUT:
G
I
T
H
U
B
GI
IT
TH
HU
UB
GIT
ITH
THU
HUB
GITH
ITHU
THUB
GITHU
ITHUB
GITHUB