Question
Take a single line text message from the user Separate the vowels from the
text. Find the repeating occurrences of vowels from the text message
Display count of which vowel has repeated how many times
Display a new Text message by removing the vowel characters as output
Display the output in the exact format shown below in example, after
displaying count of characters on next lines display the new text message
on next line. "HII wiem" is the new text message.
If a text message entered by a user does not contain any vowels then
display O as output If a text message entered by a user contains any
numeric value then display O as output
If User enters a blank or empty text message, display "INVAUD INPUT" as
output. Message "INVALID INPUT" is case sensitive Display it in the exact
format given.write a program code for this.
Answers
Answered by
3
Answer:
/ C++ program to remove vowels from a String
#include <bits/stdc++.h>
using namespace std;
string remVowel(string str)
{
vector<char> vowels = {'a', 'e', 'i', 'o', 'u',
'A', 'E', 'I', 'O', 'U'};
for (int i = 0; i < str.length(); i++)
{
if (find(vowels.begin(), vowels.end(),
str[i]) != vowels.end())
{
str = str.replace(i, 1, "");
i -= 2;
}
}
return str;
}
// Driver Code
int main()
{
string str = "GeeeksforGeeks - A Computer"
" Science Portal for Geeks";
cout << remVowel(str) << endl;
return 0;
}
// This code is contributed by
// sanjeev2552
Similar questions