lina_os

Untitled

Apr 7th, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  8. string s;
  9. cin >> s;
  10. string ones;
  11. for (int i=0; i<s.size(); i++) {
  12. if (s[i]=='1') {
  13. ones.push_back('1');
  14. }
  15.  
  16. }
  17. int f=0;
  18. for (int i=0; i<s.size(); i++) {
  19. if (s[i]=='1') {
  20. continue;
  21. }
  22. if (s[i]=='2' && !f) {
  23. f++;
  24. cout << ones;
  25. }
  26. cout << s[i];
  27. }
  28. return 0;
  29.  
  30. }
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment