Given a string str consisting of uppercase and lowercase characters. The task is to sort uppercase and lowercase characters 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: str = “gEeksfOrgEEkS”
Input: str = “eDefSR”
Approach: The idea is simple to store lower case characters and upper case characters in two different vectors and sort both of the vectors. Then use the sorted vectors to get the sorted string.
Below is the implementation of the above approach:
- Sorting Strings using Bubble Sort
- Sorting array of strings (or words) using Trie
- Case-specific sorting of Strings in O(n) time and O(1) space
- Sorting array of strings (or words) using Trie | Set-2 (Handling Duplicates)
- Know Your Sorting Algorithm | Set 1 (Sorting Weapons used by Programming Languages)
- Know Your Sorting Algorithm | Set 2 (Introsort- C++’s Sorting Weapon)
- Meta Strings (Check if two strings can become same after a swap in one string)
- Search in an array of strings where non-empty strings are sorted
- Number of common base strings for two strings
- Pairs of complete strings in two sets of strings
- Count of strings that become equal to one of the two strings after one removal
- Distinct strings such that they contains given strings as sub-sequences
- Sorting Terminology
- Alternative Sorting
- Sorting in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.