Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void main()
- {
- string str;
- cout << "Enter the string: ";
- getline(cin, str);
- for (int i = 0; i < str.size(); i++) {
- if (isupper(str[i]) && ((i == 0) || (str[i - 1] == ' ')))
- {
- int k = i;
- while ((str[i] != ' ') && (str[i] != '\0')) i++;
- str.erase(k, (i - k));
- i = k;
- }
- }
- cout << str << endl;
- system("pause");
- }
Add Comment
Please, Sign In to add comment