Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(void)
- {
- string S;
- string S0;
- char C;
- cout << "Enter string S" << endl;
- getline(cin,S);
- cout << "Enter string S0" << endl;
- getline(cin,S0);
- cout << "Enter symbol" << endl;
- cin >> C;
- for (int i=0; i<S.length(); i++)
- if (S[i]==C)
- {
- S.insert(i+1,S0);
- i+=S0.length();
- }
- cout << "New string" << endl << S << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment