fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string s = "100#100-100,101#101-101,109#109-109";
  10.  
  11. s = regex_replace(s + "0123456789", regex("0(?=.*(1))(?=9*-)|\\d{10}$"), "<$1>");
  12. cout << s << '\n';
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
100#10<1>-100,101#101-101,109#1<1>9-109<1>