Given a string S consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase letters separately such that if the ith place in the original string had an Uppercase character then it should not have a lowercase character after being sorted and vice versa.
Input: N = 12 S = defRTSersUXI Output: deeIRSfrsTUX Explanation: Sorted form of given string with the same case of character as that in original string is deeIRSfrsTUX
Input: N = 6 S = srbDKi Output: birDKs Explanation: Sorted form of given string with the same case of character will result in output as birDKs.
You only need to complete the function caseSort that returns sorted string.
Expected Time Complexity: O(N*Log(N)).
Expected Auxiliary Space: O(N).
1 ≤ N ≤ 103
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.