fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main() {
  5. // your code goes here
  6. std::string str = "its<k>hui op<o> its";
  7.  
  8. const std::string::size_type open_tag = str.find("<k>");
  9. const std::string::size_type close_tag = str.find("<o>", open_tag);
  10.  
  11. if (open_tag != std::string::npos && close_tag != std::string::npos)
  12. {
  13. str.replace(open_tag + 3, close_tag - open_tag - 3, "");
  14. }
  15.  
  16. std::cout<<str;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
its<k><o> its