Problem:
Given a string, you have to all continuous substrings of different lengths
Ex for abc, print a,ab,abc,b,bc,c
Given a string, you have to all continuous substrings of different lengths
Ex for abc, print a,ab,abc,b,bc,c
Ex for abc, print a,ab,abc,b,bc,c
Input Format:
A String
A String
Output Format:
Different substrings in each line
Constraints:
None
None
Sample Input
perl
perl
Sample Output:
p
pe
per
perl
e
er
erl
r
rl
l
p
pe
per
perl
e
er
erl
r
rl
l
pe
per
perl
e
er
erl
r
rl
l
try this (does produce answers in a different order) :
ReplyDeleteecho perl | perl -lne '/.+(??{print$&})^/'