fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. std::string str{ "[1,2,3,,,,,4]" };
  6. do {
  7. auto pos = str.find( ",," );
  8. if( pos == std::string::npos )
  9. break;
  10. str.insert( pos + 1, "null" );
  11. } while( true );
  12. std::cout << str << std::endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
[1,2,3,null,null,null,null,4]