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:
- Count of all unique substrings with non-repeating characters
- Count number of distinct substrings of a given length
- Count all Prime Length Palindromic Substrings
- 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
- Length of longest Palindromic Subsequence of even length with no two adjacent characters same
- Minimum length of the sub-string whose characters can be used to form a palindrome of length K
- Maximum contiguous 1 possible in a binary string after k rotations
- Contiguous subsegments of a string having distinct subsequent characters
- Distinct state codes that appear in a string as contiguous sub-strings
- Find substrings that contain all vowels
- Count substrings with same first and last characters
- Replace two substrings (of a string) with each other
- Count all substrings having character K
- Number of substrings of a string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.