- 0
Notifications Mark All Read
- Login
- Get Prime
Cognizant Coding Question- 5
Access Denied!
To view this page you have to login first
Login here -
Trivia
Did you know 1 million people use PrepInsta everyday?
Notifications Mark All Read
To view this page you have to login first
Login here -
Did you know 1 million people use PrepInsta everyday?
#include
using namespace std;
int main()
{
string str;
getline(cin,str);
int n=str.size();
cout<<str<<endl;
for(int i=0;i<n;++i)
{
if(str[i]!='a'&&str[i]!='e'&&str[i]!='i'&&str[i]!='o'&&str[i]!='u'&&str[i]!='A'&&str[i]!='E'&&str[i]!='I'&&str[i]!='O'&&str[i]!='U')
{
cout<<str[i];
}
}
}
import java.util.*;
public class RemoveVowel {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String s1=sc.nextLine();
String s2=””;
for(int i=0;i<s1.length();i++)
{
if(!(s1.charAt(i)=='a'||s1.charAt(i)=='e'||s1.charAt(i)=='i'||s1.charAt(i)=='o'||
s1.charAt(i)=='u'||s1.charAt(i)=='A'||s1.charAt(i)=='E'||s1.charAt(i)=='I'||
s1.charAt(i)=='O'||s1.charAt(i)=='U'))
{
s2=s2+s1.charAt(i);
}
}
System.out.println(s2);
}
}
This is Simple Solution