fork(3) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <regex>
  4. #include <string>
  5.  
  6. int main()
  7. {
  8.  
  9. std::string ss ("1 + (3+2)9 - 2 ");
  10. static const std::regex ee ("\\)(\\d)");
  11.  
  12. std::string result;
  13. std::regex_replace (std::back_inserter(result), ss.begin(), ss.end(), ee, ")*$1");
  14. std::cout << result;
  15. return 0;
  16. }
Success #stdin #stdout 0s 3368KB
stdin
Standard input is empty
stdout
1 + (3+2)*9 - 2