Advertisement
myloyo

7.2.1

Dec 14th, 2022 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6.     string str, x;
  7.     char y;
  8.     cin >> x >> y >> str;
  9.     for (int i = 0; i < str.length(); i++) {
  10.         if (str[i] == y) {
  11.             str.insert(i + 1, x);
  12.             i++;
  13.         }
  14.     }
  15.     cout << str;
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement