We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dccf3c6 commit da6ee49Copy full SHA for da6ee49
Strings/Substrings.class
160 Bytes
Strings/Substrings.java
@@ -15,13 +15,28 @@ static void printAllSubstrings(String str)
15
16
}
17
18
+ static void printAllSubstringsReverse(String str)
19
+ {
20
+
21
+ int n=str.length();
22
+ for(int st=n-1;st>=0;st--)
23
24
+ for(int en=st+1;en<=n;en++)
25
26
+ System.out.println(str.substring(st, en));
27
+ }
28
29
30
31
32
33
public static void main(String[] args) {
34
35
String str="abc";
36
- printAllSubstrings(str);
37
+ // printAllSubstrings(str);
38
39
+ printAllSubstringsReverse(str);
40
41
42
0 commit comments