Given a string str and an integer L. The task is to print all the unique substring of length L from string str.
Input: str = “abca”, L=3
Output: “abc”, “bca”
Input: str = “aaaa”, L=3
Firstly genearate all the substring of length L and then by using set we can insert unique sub-string till the length L and then print the result.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Count of all unique substrings with non-repeating characters
- Count number of distinct substrings of a given length
- Minimum flips required to convert given string into concatenation of equal substrings of length K
- Calculate Sum of ratio of special characters to length of substrings of the given string
- Split a given string into substrings of length K with equal sum of ASCII values
- Count of unique palindromic strings of length X from given string
- Convert all substrings of length 'k' from base 'b' to decimal
- Find number of substrings of length k whose sum of ASCII value of characters is divisible by k
- Count all Prime Length Palindromic Substrings
- Count of substrings of length K with exactly K distinct characters
- Check if a string can be split into even length palindromic substrings
- Minimize length of Substrings containing at least one common Character
- Count of Substrings having Sum equal to their Length
- Number of substrings with length divisible by the number of 1's in it
- Check if all substrings of length K of a Binary String has equal count of 0s and 1s
- Given a number as a string, find the number of contiguous subsequences which recursively add up to 9
- Given a number as a string, find the number of contiguous subsequences which recursively add up to 9 | Set 2
- Minimum number of substrings the given string can be splitted into that satisfy the given conditions
- Reverse the substrings of the given String according to the given Array of indices
- Maximum contiguous 1 possible in a binary string after k rotations
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.