fork download
  1. #include<iostream>
  2. #include<string>
  3.  
  4. using namespace std;
  5. void xoa(string &s,int vt){
  6. for(int i = vt;i < s.length()-1;i++){
  7. s[i] = s[i+1];
  8. }
  9. s[s.length()] = '\0';
  10. }
  11. int main(){
  12. string s;
  13. string s1;
  14. char x,y;
  15. int count = 0;
  16. getline(cin,s);
  17. cin >> s1;
  18. x = s1[0];y = s1[1];
  19. //cin >> x >> y;
  20. for(int i = 0;i < s.length();i++){
  21. if(s[i] != x && s[i] != y){
  22. xoa(s,i);
  23. }
  24. }
  25. cout << s;
  26. return 0;
  27. }
Success #stdin #stdout 0s 4272KB
stdin
abcd
ab
stdout
abdd