Category Archives: Strings

Questions related to strings

Print all the duplicates 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 0.

Return maximum occurring character in the input string

Write an efficient C function to return maximum occurring character in the input string e.g., if input string is “test” then function should return ‘t’. We strongly recommend that you click here and practice it, before moving on to the solution. Algorithm: One obvious approach to solve this problem would be to sort the input… Read More »