Remove vowels from a string and return the string with consonants | FACE Prep
Published on 09 Mar 2020
In a town, houses are marked with English alphabets. Committee in the town wants to renovate the houses. They decided to renovate only houses named with vowels. Committee has given the list to members and asks them to identify the houses which are not renovated. Write an algorithm to help the committee members to find houses which are not renovated.
- Input: Input to the function contains only one argument.
- House: A string representing the sequence of house markings.
- Output: return a string that represents the houses which were not renovated.
The logic to be used:
The logic behind this question is simple. It is to remove the vowels in the given string and display the input string without vowels (i.e with only consonants).
Algorithm to remove vowels from string
- Get the input as a string
- Define or initialize a string containing the vowels i.e., a, e,i, o, u.
- Traverse through the input string, if the vowel is encountered, it should be removed from the string.
- Another way is to initialize another string and copy each non-vowel character to this string from the input string.
- Display the final result string.
Program to remove vowels from a string
Asked in recruitment drive of companies like Wipro
If you have any feedback about this
article and want to improve this, please write to firstname.lastname@example.org