Write an efficient C program to print all the duplicates and their counts in the input string
Algorithm: Let input string be “geeksforgeeks”
1: Construct character count array from the input string.
count[‘e’] = 4
count[‘g’] = 2
count[‘k’] = 2
2: Print all the indexes from the constructed array which have value greater than 1.
s, count = 2 t, count = 3
Time Complexity : O(n)
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Print distinct sorted permutations with duplicates allowed in input
- Print a closest string that does not contain adjacent duplicates
- Remove duplicates from a given string
- Remove all consecutive duplicates from the string
- Remove all duplicates from a given string in Python
- Remove three consecutive duplicates from string
- Character replacement after removing duplicates from a string
- Remove duplicates from a string in O(1) extra space
- Program to check if input is an integer or a string
- Maximum occurring character in an input string | Set-2
- Return maximum occurring character in an input string
- Efficiently check if a string has duplicates without using any additional data structure
- Generate two output strings depending upon occurrence of character in input string.
- Generate two output strings depending upon occurrence of character in input string in Python
- Print shortest path to print a string on screen