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 :
- Modify string by removing vowels in between two consonants
- Reverse vowels in a given string
- Print reverse of a string using recursion
- Print words of a string in reverse order
- Check if a string can be converted to another string by replacing vowels and consonants
- Print an N x M matrix such that each row and column has all the vowels in it
- Print number of words, vowels and frequency of each character
- First X vowels from a string
- Modify the string such that it contains all vowels at least once
- Program to remove vowels from a String
- Count the pairs of vowels in the given string
- Permutations of string such that no two vowels are adjacent
- Remove consecutive vowels from string
- Check whether the vowels in a string are in alphabetical order or not
- Replace all consonants with nearest vowels in a string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.