Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- using namespace std;
- int main()
- {
- cout << "Enter text: " << endl;
- string text, word;
- getline(cin, text);
- stringstream s(text);
- while (s >> text)
- {
- int len = text.length();
- if (ispunct(text.at(len - 1)))
- {
- len--;
- }
- char symbol = text.at(len - 1);
- int poz = 0;
- for (int i = 0; i < len - 2; i++)//-2 or -1
- {
- int posit;
- posit = text.find(symbol, poz);
- if ((posit>=0)&&(posit!=len-1))
- {
- poz += posit + 1;///
- text.replace(posit, 1, "+");
- }
- else break;
- }
- }
- cin.ignore(100, '\n');
- cin.clear();
- cout << text;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement