Program Discussion :: Basics
2 / 279
Write a program to remove the vowels from the input string.
Answer:
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Asked In ::
Language:

Rai
7 May, 2017 11:51 AM
import java.util.*;
import java.lang.*;
import java.io.*;
class RemoveVowel
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter String: ");
String str=sc.nextLine();
System.out.println("The String after Vowel Removal is: ");
String str2=str.replaceAll("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Monika
11 Jun, 2017 1:22 PM
<!DOCTYPE html>
<html>
<body>
<?php
function Vowels() {
/* input string */
$arr ="what is your name";
echo "Input string is :" . $arr."<br/>";
/* initialising an empty array and its initial index */
$arrc=array(); $j=0;
$arrlength=strlen($arr);
/* loop for reading the input array */
for($x=0; $x< $arrlength; $x++)
{
/* comparing each character with vowels */
if( ($arr[$x]=="a")||($arr[$x]=="e")||($arr[$x]=="i")||($arr[$x]=="o")||($arr[$x]=="u"))
{
continue ; /* for repeating the loop and skipping the below statement */
}
else
{
$arrc[$j]=$arr[$x]; /* adding character without vowels into different array */
$j++;
}
}
$name= implode ("",$arrc); /* conversion of array into string */
echo $name; /* printing string without vowels */
}
Vowels();
?>
</body>
</html>
Language:

Rai
18 Jun, 2017 3:55 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Aditya
7 Jul, 2017 9:27 AM
#include <stdio.h>
#include <string.h>
int check_vowel(char);
int main()
{
char s[100], t[100];
int i, j = 0;
printf("Enter a string to delete vowels\n");
gets(s);
for(i = 0; s[i] != '\0'; i++) {
if(check_vowel(s[i]) == 0) { /* not a vowel */
t[j] = s[i];
j++;
}
}
t[j] = '\0';
strcpy(s, t); /* We are changing initial string */
printf("String after deleting vowels: %s\n", s);
return 0;
}
int check_vowel(char c)
{
switch(c) {
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
return 1;
default:
return 0;
}
}
Language:

Neha
7 Jul, 2017 9:30 AM
#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
int check_vowel(char);
int main()
{
char s[100], t[100];
int i, j = 0;
cout<<"Enter a string to delete vowels\n";
gets(s);
for(i = 0; s[i] != '\0'; i++) {
if(check_vowel(s[i]) == 0) { //not a vowel
t[j] = s[i];
j++;
}
}
t[j] = '\0';
strcpy(s, t); //We are changing initial string
cout<<"String after deleting vowels: %s\n";
return 0;
}
int check_vowel(char c)
{
switch(c) {
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
return 1;
default:
return 0;
}
}
Language:

Amit
24 Aug, 2017 11:53 PM
import java.util.Scanner;
class RemoveVowel
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the input");
String str=sc.nextLine();
String result=str.replaceAll("[aeiouAEIOU]","");
System.out.println("After removed vowel:- "+result);
}
}
Language:

Veera Chowdary Kamani
4 Sep, 2018 3:35 PM
st="what is your name?"
v=("a","e","i","o","u")
for i in v:
st=st.replace(i,"")
print(st)
Language:

Siddhartha Paul
19 Jun, 2019 2:16 PM
import java.io.*;
public class RemoveVowels
{
public static void main(String[] args)throws IOException
{
String str1=""; //New string which will contain no vowels.
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a String: ");
String str=br.readLine(); //Initial string containing vowel.
int len = str.length();
for(int i=0;i<len;i++)
{
char ch=str.charAt(i);
if((ch=='A')||(ch=='E')||(ch=='I')||(ch=='O')||(ch=='U')||(ch=='a')||(ch=='e')||(ch=='i')||(ch=='o')||(ch=='u'))
continue;
else
str1=str1+ch;
}
System.out.println("String after removing vowels: "+str1);
}
}
Language:

Abhi
10 Mar, 2020 2:15 PM
def rem_vowels(string):
vowels=('a','e','i','o','u')
for x in string.lowercase():
if x in vowels():
string=string.replace(x,"")
print(string)
string="what is your name?"
rem_vowels(string)
Language:

Baig
3 Jun, 2020 11:38 AM
<pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'JetBrains Mono';font-size:9.8pt;"><span style="color:#cc7832;">import </span>java.util.Scanner<span style="color:#cc7832;">;<br></span><span style="color:#cc7832;"><br></span><span style="color:#cc7832;">public class </span>Removethevowels {<br> <span style="color:#cc7832;">public static void </span><span style="color:#ffc66d;">main</span>(String[] args) {<br> Scanner sc = <span style="color:#cc7832;">new </span>Scanner(System.<span style="color:#9876aa;font-style:italic;">in</span>)<span style="color:#cc7832;">;<br></span><span style="color:#cc7832;"> </span>String s = sc.nextLine()<span style="color:#cc7832;">;<br></span><span style="color:#cc7832;"> </span>String a = <span style="color:#6a8759;">""</span><span style="color:#cc7832;">;<br></span><span style="color:#cc7832;"> for </span>(<span style="color:#cc7832;">int </span>i = <span style="color:#6897bb;">0</span><span style="color:#cc7832;">; </span>i
Language:

Prusti
29 Apr, 2021 8:41 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Prusti
29 Apr, 2021 8:42 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Reddy
11 Sep, 2021 4:04 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Reddy
11 Sep, 2021 4:04 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Reddy
11 Sep, 2021 4:04 PM
def anti_vowel(c):
newstr = c
vowels = ('a', 'e', 'i', 'o', 'u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x,"")
Language:

Anki
17 Sep, 2021 11:09 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Anki
17 Sep, 2021 11:09 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Anki
17 Sep, 2021 11:10 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Anki
17 Sep, 2021 11:10 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Anki
17 Sep, 2021 11:10 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Anki
17 Sep, 2021 11:11 AM
import java.util.*;
import java.lang.*;
import java,io.*;
class RemovalVowel()
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("enter string:");
String str=sc.nextLine();
System.out.println("string after removing vowels is:");
String str2=str.replaceALL("[aeiouAEIOU]","");
System.out.println(str2);
}
}
Language:

Gupta
18 Oct, 2021 12:43 PM
def anti_vowel(c):
newstr = c
vowels = ('a','e','i','o','u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x, " ")
Language:

Gupta
18 Oct, 2021 12:43 PM
def anti_vowel(c):
newstr = c
vowels = ('a','e','i','o','u')
for x in c.lower():
if x in vowels:
newstr = newstr.replace(x, " ")
Language:

Kumari
9 Jan, 2022 10:44 PM
//Write a program to remove the vowels from the input string.
import java.util.*;
public class Practice2 {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
String st = s.nextLine();
StringBuffer sb = new StringBuffer(st);
int i=0;
while(i<sb.length())
{
if(sb.charAt(i)=='a' || sb.charAt(i)=='e' || sb.charAt(i)=='i' || sb.charAt(i)=='o' || sb.charAt(i)=='u' || sb.charAt(i)=='A' || sb.charAt(i)=='E' || sb.charAt(i)=='I' || sb.charAt(i)=='O' || sb.charAt(i)=='U') {
sb.deleteCharAt(i);
continue;
}
i ;
}
System.out.println(sb);
}
}
Language:

Kumari
9 Jan, 2022 10:44 PM
//Write a program to remove the vowels from the input string.
import java.util.*;
public class Practice2 {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
String st = s.nextLine();
StringBuffer sb = new StringBuffer(st);
int i=0;
while(i<sb.length())
{
if(sb.charAt(i)=='a' || sb.charAt(i)=='e' || sb.charAt(i)=='i' || sb.charAt(i)=='o' || sb.charAt(i)=='u' || sb.charAt(i)=='A' || sb.charAt(i)=='E' || sb.charAt(i)=='I' || sb.charAt(i)=='O' || sb.charAt(i)=='U') {
sb.deleteCharAt(i);
continue;
}
i ;
}
System.out.println(sb);
}
}