fork(3) download
  1. #include <iostream>
  2. #include <regex>
  3.  
  4. int main() {
  5. std::string S = "-0001011101";
  6. std::regex reg("([^1]|^)1(?!1)");
  7. std::cout << std::regex_replace(S, reg, "$012") << std::endl;
  8. return 0;
  9. }
Success #stdin #stdout 0s 5340KB
stdin
Standard input is empty
stdout
-0002011102