Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setlocale(LC_ALL, "Russian");
- string sub, s;
- cout << "Введите строку 1: ";
- getline(cin,s);
- cout << "Введите строку 2: ";
- cin >> sub;
- string::size_type i = s.find(sub);
- /*string::size_type j = s.empty();
- if (j == s.empty())
- {
- s.erase(j,s.size());
- }*/
- for (int i = 0; i < s.length(); i++)
- {
- if (s[i] == ';' || s[i] == '!' || s[i] == ' ' || s[i] == ',' || s[i] == '.')
- { s.erase(i,1);}
- if (s.find(sub)==i)
- {
- s.erase(i,sub.size());
- }
- }
- cout << s << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement