-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisemvowel-Trolls.cpp
More file actions
40 lines (35 loc) · 988 Bytes
/
Disemvowel-Trolls.cpp
File metadata and controls
40 lines (35 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<algorithm>
#include<vector>
#include <array>
#include<cmath>
#include <string>
using namespace std;
string disemvowel(string str)
{
string result;
for (int i = 0; i < str.size(); 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')
{
continue;
}
else
{
result += str[i];
}
}
return result;
}
int main()
{
cout << disemvowel("This website is for losers LOL!");
return 0;
}
/*Description:
Trolls are attacking your comment section!
A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat.
Your task is to write a function that takes a string and return a new string with all vowels removed.
For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!".
Note: for this kata y isn't considered a vowel.
*/