Given a string s, print reverse of string and remove the characters from the reversed string where there are vowels in the original string.
Input : geeksforgeeks Output : segrfseg Explanation : Reversed string is skeegrofskeeg, removing characters from indexes 1, 2, 6, 9 & 10 (0 based indexing), we get segrfseg . Input :duck Output :kud
A simple solution is to first reverse the string, then traverse the reversed string and remove vowels.
An efficient solution is to do both tasks in one traversal.
Create an empty string r and traverse the original string s and assign the value to the string r. Check whether, at that index, the original string contains a consonant or not. If yes then print the element at that index from string r.
Basic implementation of the above approach :
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print string after removing all (“10” or “01”) from the binary string
- Modify string by removing vowels in between two consonants
- Find the number of words of X vowels and Y consonants that can be formed from M vowels and N consonants
- Reverse vowels in a given string
- Minimum swaps required to move all vowels occurs after consonants in a given string
- Character replacement after removing duplicates from a string
- Balance a string after removing extra brackets
- Find the resultant String after replacing X with Y and removing Z
- Check if string remains palindrome after removing given number of characters
- Check if string is palindrome after removing all consecutive duplicates
- Minimum sum of squares of character counts in a given string after removing k characters
- Check if a string can be converted to another string by replacing vowels and consonants
- Find the player to last modify a string such that even number of consonants and no vowels are left in the string
- Print number of words, vowels and frequency of each character
- Print an N x M matrix such that each row and column has all the vowels in it
- Print the Vowels in the Order of their occurrence in the given Matrix
- Sentence Palindrome (Palindrome after removing spaces, dots, .. etc)
- Subsequence queries after removing substrings
- Minimize ASCII values sum after removing all occurrences of one character
- Maximum points covered after removing an Interval
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.