fork download
  1. #include<iostream>
  2. #include<string>
  3. #include<algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main(void) {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(NULL);
  10. string bomb;
  11. string str;
  12. char ans[1000005];
  13. cin >> str >> bomb;
  14. int iter = 0;
  15. for(int i = 0; i<str.length();i++){
  16. ans[iter] = str[i];
  17. iter++;
  18. bool chk = false;
  19. for (int j = 0; j < bomb.length(); j++) {
  20. if (ans[iter - 1] == bomb[j]) {
  21. chk = true;
  22. break;
  23. }
  24. }
  25. if (chk) {
  26. iter--;
  27. }
  28. }
  29. if (iter == 0) {
  30. cout << "FRULA";
  31. }
  32. else {
  33. for (int i = 0; i < iter; i++) {
  34. cout << ans[i];
  35. }
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0s 4380KB
stdin
CCC44
C4
stdout
FRULA