Now I have a string just including uppercases and lowercases. I want to change the string to the form that all the uppercases are behind the lowercases, and, the relative order of all the uppercases or the lowercases is not changed.
For example, a string “aAbBcCDd” changes to “abcdABCD”. A string “aaAAAbb” changes to “aabbAAA”.
if I define length of string an “N”, now I have an algorithm that is O(NlogN). But I want to know if there is an algorithm that costs smaller time. Of course , memory is limited too. The memory don’t depend on the Length is most fantastic.
Thank you very much!!!
Algorithm:
Input: Your String in mixed lower and upper case
Output: A String with lower case then upper case (relative order not changed)