Sort string based upon the count of characters Options
- by prp
Sample Data :
input : "abcdacdc"
Output : "cadb"
here we have to sort strings in order of count of characters.
If the count is same for characters. maintain the original order of
the characters from input string.
my approach: i have used array of 26 for maintaining occurrence of all characters and sort it then print it.But while doing so i am not able to maintain order in case if two characters have same count.
please suggest any improvement or any other algo.