Given two strings, we need to take the character which has the maximum occurrence in the first string and then we have to check if that particular character is present in the second string the same number of times as it is present in the first string.
Input : s1 = "sssgeek", s2 = "geeksss" Output : Yes Max occurring character in s1 is 's'. It occurs same number of times in s2. Input : geekyarticle gfggfggfg Output : No
Store counts of characters in first string and find the maximum count. Now traverse through the second string and check if the maximum occurring character occurs same number of times or not.
Below program to illustrate the above problem
- Longest subsequence where every character appears at-least k times
- Count substrings with each character occurring at most k times
- Remove characters from string that appears strictly less than K times
- Maximum occurring character in an input string | Set-2
- Replace every character of string by character whose ASCII value is K times more than it
- Return maximum occurring character in an input string
- Print the string after the specified character has occurred given no. of times
- Encrypt a string by repeating i-th character i times
- Decrypt a string encrypted by repeating i-th character i times
- Find the only element that appears b times
- Check if frequency of character in one string is a factor or multiple of frequency of same character in other string
- Count all elements in the array which appears at least K times after their first occurrence
- Maximum occurring character in a linked list
- Check if both halves of the string have at least one different character
- Check whether the Average Character of the String is present or not
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.