Cognizant Coding Question- 5

2 comments on “Cognizant Coding Question- 5”


  • Santanu

    #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];
    }
    }

    }


  • Aqib

    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