Given a string containing lowercase and uppercase letters.sort it in such a manner such that the uppercase and lowercase letter comes in an alternate manner but in sorted way.
Input : bAwutndekWEdkd Output :AbEdWddekkntuw Explanation: Here we can see that letter ‘A’, ’E’, ’W’ are sorted as well as letters “b, d, d, d, e, k, k, n, t, u, w” are sorted but both appears alternately in the string as far as possible. Input :abbfDDhGFBvdFDGBNDasZVDFjkb Output :BaBaDbDbDbDdDfFhFjFkGsGvNVZ
1) Count lower case characters in an array lCount
2) Count upper case characters in another array uCount
3) Modify string using lCount and uCount
Time Complexity : O(n)
- Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
- Lower case to upper case - An interesting fact
- Alternate vowel and consonant string
- Reverse alternate k characters in a string
- Check if it is possible to rearrange a binary string with alternate 0s and 1s
- Rearrange a binary string as alternate x and y occurrences
- Lexicographically first alternate vowel and consonant string
- Number of flips to make binary string alternate | Set 1
- Print the string by ignoring alternate occurrences of any character
- Minimum number of characters to be removed to make a binary string alternate
- Sort a string according to the order defined by another string
- Sort string of characters
- Sort string of characters using Stack
- Sort the given string using character search
- Sort an array of strings according to string lengths
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.
Improved By : parashar