Untitled
unknown
plain_text
3 years ago
801 B
17
Indexable
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
string onlyConnectize(string phrase){
if(phrase.empty())
return "";
phrase[0] = toupper(phrase[0]);
if(phrase[0] == 'A' || phrase[0] == 'E' || phrase[0] == 'I' || phrase[0] == 'O' || !isalpha(phrase[0]))
return onlyConnectize(phrase.substr(1));
else
return phrase[0] + onlyConnectize(phrase.substr(1));
}
int main()
{
cout << onlyConnectize("Elena Kagan") << endl;
cout << onlyConnectize("Antonin Scalia") << endl;
cout << onlyConnectize("EE 364A") << endl;
cout << onlyConnectize("For sale: baby shoes, never worn.") << endl;
cout << onlyConnectize("I'm the bad guy. (Duh!)") << endl;
cout << onlyConnectize("Annie Mae, My Sea Anemone Enemy!") << endl;
}Editor is loading...