Remove vowels from a string and return the string with consonants | faceprep

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).

remove vowels from string examples

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 delete vowels from a string

To receive Placement preparation tips and Placement related updates, come join the largest placement Community on FACE’s Telegram and WhatsApp, and take your placement preparation to the next level.
Join here:
#include <stdio.h>
int check_vowel(char);
int main()
char s[100], t[100];
int c, d = 0;
for(c = 0; s[c] != ‘\0’; c++)
if(check_vowel(s[c]) == 0)
t[d] = s[c];
t[d] = ‘\0’;
strcpy(s, t);
printf(“%s\n”, s);
return 0;
int check_vowel(char ch)
if (ch == ‘a’ || ch == ‘A’ || ch == ‘e’ || ch == ‘E’ || ch == ‘i’ || ch == ‘I’ || ch ==’o’ || ch==’O’ || ch == ‘u’ || ch == ‘U’)
return 1;
return 0;
#include <iostream.h>
#include <string.h>
#include <conio.h>
#include <cstring.h>
using namespace std;
int check_vowel(char check_character)              // To check the vowels
if (check_character == 'a' || check_character =='A' ||
check_character == 'e' || check_character =='E' || check_character == 'i' ||
check_character =='I' || check_character == 'o' || check_character =='O' || check_character == 'u' || check_character =='U')
   return 1;
   return 0;
int main()
   string input_string;
   int j=0;
   cout<<"Enter the String:";                 // Getting Input String
   int string_length = 0;
   while (input_string[string_length])
       string_length++; // Calculating the size of the string
   char result_string[string_length];
   for(int i=0; i< string_length; i++)
       int temp = check_vowel(input_string[i]);
       if (temp == 0) //if not a vowel, it will be attached to the new string
        result_string[j] += input_string[i];
return 0;

import java.util.Scanner;
public class Main
   public static void main(String[] args)
       System.out.println(“Enter the string…”);
       Scanner sc = new Scanner(;
       String input = sc.nextLine();
       String result = input.replaceAll(“[AEIOUaeiou]”, “”);                 // Replacing the vowels with “”

s = input(“Enter any string to remove all vowels from it: “)
vowels = (‘aeiou’)  
s = s.lower()
for x in s:
   if x in vowels:
       s = s.replace(x, “”)   // Replacing the vowels with ‘’