http://oj.tsinsen.com/A1102
#include "bits/stdc++.h"
using namespace std;
int main () {
string s;
getline(cin, s);
char cmd, s1, s2;
cin >> cmd;
switch (cmd) {
case 'D':
cin >> s1;
s.erase(s.find_first_of(s1), 1);
cout << s;
break;
case 'I':
cin >> s1 >> s2;
s.insert(s.begin() + s.find_last_of(s1), s2);
cout << s;
break;
case 'R':
cin >> s1 >> s2;
int len = s.size();
for (int i = 0; i < len; ++i)
if (s[i] != s1) cout << s[i];
else cout << s2;
break;
}
return 0;
}