fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. std::string routingLine = "ABC DEB MEM DEB LOL HEH PUC";
  6. std::string starAtsRouteDescription = "DEB";
  7.  
  8. size_t found = routingLine.rfind(starAtsRouteDescription);
  9. if (found != string::npos) {
  10. routingLine.replace(found - 1, starAtsRouteDescription.length() + 1, "");
  11. }
  12.  
  13. cout << routingLine;
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
ABC DEB MEM LOL HEH PUC