Your friend is trying to write a function that removes all vowels from a string. They write:
std::string removeVowels(std::string text) {
std::regex vowels("[aiou]");
std::stringstream result;
std::regex_replace(std::ostream_iterator<char>(result), text.begin(), text.end(), vowels, "");
return result.str();
}However, it seems that it doesn't work? Fix your friend's code so that it actually does remove all vowels.
removeVowels("candy") ➞ "cndy"
removeVowels("hello") ➞ "hell"
// The "o" is removed, but the "e" is still there!
removeVowels("apple") ➞ "pple"All letters will be lowercase.