Category Archives: Strings

Questions related to strings

Run Length Encoding

Given an input string, write a function that returns the Run Length Encoded string for the input string.

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.