fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. for (string s; cin >> s; ) {
  10. std::stable_partition(s.begin(), s.end(), [](char ch) { return ch != '0'; });
  11. cout << s << endl;
  12. }
  13. }
Success #stdin #stdout 0s 3480KB
stdin
20010307
001
000
1230984102340130123920812358031418230958230941923841072349
stdout
21370000
100
000
1239841234131239281235831418239582394192384172349000000000