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:
- Convert all substrings of length 'k' from base 'b' to decimal
- Count number of distinct substrings of a given length
- Count all Prime Length Palindromic Substrings
- Find number of substrings of length k whose sum of ASCII value of characters is divisible by k
- 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
- Distinct state codes that appear in a string as contiguous sub-strings
- Find substrings that contain all vowels
- Number of substrings of a string
- Replace two substrings (of a string) with each other
- Number of substrings divisible by 8 but not by 3
- Count all substrings having character K
- Count substrings that contain all vowels | SET 2
- Count substrings with same first and last characters
- Count Substrings with equal number of 0s, 1s and 2s
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.