Given a string. The task is to find the maximum occurred substring with a maximum length. These occurrences can overlap.
Input: str = "abab" Output: ab "a", "b", "ab" are occur 2 times. But, "ab" has maximum length Input: str = "abcd" Output: a
Approach: The idea is to store the frequency of each substring using a map and print the one with maximum frequency and maximum length.
Below is the implementation of the above approach:
- Substring with highest frequency length product
- Length of the largest substring which have character with frequency greater than or equal to half of the substring
- Frequency of a substring in a string
- Frequency of a substring in a string using pthread
- Number of Positions to partition the string such that atleast m characters with same frequency are present in each substring
- Maximum length substring having all same characters after k changes
- Find length of longest subsequence of one string which is substring of another string
- Check if the frequency of any character is more than half the length of the string
- Maximum length palindromic substring such that it starts and ends with given char
- Convert to a string that is repetition of a substring of k length
- Check if string can be rearranged so that every Odd length Substring is Palindrome
- Lexicographical Maximum substring of string
- Maximum even length sub-string that is permutation of a palindrome
- Count maximum-length palindromes in a String
- Find the first maximum length even word from 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.
Improved By : mohit kumar 29