Given a string str, the task is to remove consecutive characters from the string that are in same case (Uppercase or Lowercase) and print the resultant string.
Input: str = “GeeksForGeeks”
Input: str = “abcDEFghi”
- Print the first character as it is.
- Traverse through all the other characters in the string starting from second character.
- Compare the current and the previous characters:
- If the current and the previous characters are in the same case then skip.
- Else print the current character.
Below is the implementation of the above approach:
- Remove all characters other than alphabets from string
- Rearrange the characters of the string such that no two adjacent characters are consecutive English alphabets
- Remove three consecutive duplicates from string
- Remove consecutive vowels from string
- Remove all consecutive duplicates from the string
- Python groupby method to remove all consecutive duplicates
- Lower case to upper case - An interesting fact
- Count of alphabets having ASCII value less than and greater than k
- Program to generate random alphabets
- Sub-string that contains all lowercase alphabets after performing the given operation
- Maximum distinct lowercase alphabets between two uppercase
- Count and Print the alphabets having ASCII value not in the range [l, r]
- Check if words are sorted according to new order of alphabets
- Count and Print the alphabets having ASCII value in the range [l, r]
- Count of character pairs at same distance as in English alphabets