Your solution is giving all combinations that can be made using chars in the string Java - using recursion to create all substrings from a string, http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html, joelonsoftware.com/articles/ThePerilsofJavaSchools.html, How a top-ranked engineering school reimagined CS curriculum (Ep. Step 2: Define the main method. Generating all possible Subsequences using Recursion including the How to insert characters in a string at a certain position? I commented it a lot so you could see my thinking and hopefully tell me where I'm going wrong. Why don't we use the 7805 for car phone chargers? The next iteration of substrings will be substrings(0,2), and in.substring(0,2) will be printed, which is 12. Print all Substrings of length n possible from the given String, Print all Substrings of a String that has equal number of vowels and consonants, Generate a string whose all K-size substrings can be concatenated to form the given string, Lexicographically smallest permutation of a string that contains all substrings of another string, Count the number of vowels occurring in all the substrings of given string, Lexicographically all Shortest Palindromic Substrings from a given string, Count the number of vowels occurring in all the substrings of given string | Set 2, Count of substrings of a given Binary string with all characters same, Minimum shifts of substrings of 1s required to group all 1s together in a given Binary string, Find all substrings with even 1s whose reverse is also present in given String, Learn Data Structures with Javascript | DSA Tutorial, Introduction to Max-Heap Data Structure and Algorithm Tutorials, Introduction to Set Data Structure and Algorithm Tutorials, Introduction to Map Data Structure and Algorithm Tutorials, What is Dijkstras Algorithm? Find centralized, trusted content and collaborate around the technologies you use most. I don't see the problem. At least include what is currently in your comment under the OP's question. selenium 183 Questions Are there any canonical examples of the Prime Directive being broken that aren't shown on screen? What is the symbol (which looks similar to an equals sign) called? What is this brick with a round back and a stud on the side used for? java 12753 Questions What is COST CENTER CLASSES in TallyERP9? Write a recursive method public static String reverse(String str) Thanks. Finally, we can print our vector of strings and get the desired output. You should pass the remaining string as argument to generateSubsets (remaining) method. javafx 180 Questions Find centralized, trusted content and collaborate around the technologies you use most. swing 305 Questions -Xmx1g -XX:MaxPermSize=512m -XX:MaxHeapSize=256m. For example, with the word "Hello" of length 5, you have a Starting/Ending positions of: 1/5, 2/5, 3/5, 4/5, 1/4, 2/4, 3/4, etc. Program to print all substrings of a given string - GeeksforGeeks Fun problem, here's my solution - feedback appreciated. Your task is to complete the function AllPossibleStrings () which takes S as the input parameter and returns a list of all possible subsequences (non-empty) that can be formed from S in lexicographically-sorted order. Program to check if two strings are same or not, Remove all occurrences of a character in a string, Check if all bits can be made same by single flip, Number of flips to make binary string alternate | Set 1, Min flips of continuous characters to make all characters same in a string, Generate all binary strings without consecutive 1s, Find ith Index character in a binary string obtained after n iterations, Program to print all substrings of a given string, Count distinct occurrences as a subsequence, C Program to Check if a Given String is Palindrome, Check if a given string is a rotation of a palindrome, Check if characters of a given string can be rearranged to form a palindrome, Online algorithm for checking palindrome in a stream, Print all palindromic partitions of a string, Minimum characters to be added at front to make string palindrome, Make largest palindrome by changing at most K-digits, Minimum number of deletions to make a string palindrome, Minimum insertions to form a palindrome with permutations allowed, Generate all binary strings from given pattern, Divide large number represented as string, Program to find Smallest and Largest Word in a String, Check if all levels of two trees are anagrams or not, Queries for characters in a repeated string, URLify a given string (Replace spaces with %20), Count number of binary strings without consecutive 1s, Check if given string can be split into four distinct strings, Check for balanced parentheses in an expression | O(1) space, Convert a sentence into its equivalent mobile numeric keypad sequence, Burrows Wheeler Data Transform Algorithm, Print shortest path to print a string on screen, Multiply Large Numbers represented as Strings, Count ways to increase LCS length of two strings by one, Minimum rotations required to get the same string, Find if an array of strings can be chained to form a circle | Set 2, Given a sorted dictionary of an alien language, find order of characters, Remove minimum number of characters so that two strings become anagram, Minimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character, Minimum number of bracket reversals needed to make an expression balanced, Word Wrap problem ( Space optimized solution ), Decode a string recursively encoded as count followed by substring. How do I get a substring of a string in Python? It then defines a variable apd which stores the first character of the input string using the at() function. junit 177 Questions Thanks for contributing an answer to Code Review Stack Exchange! Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide.