Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- string s;
- cin >> s;
- string ones;
- for (int i=0; i<s.size(); i++) {
- if (s[i]=='1') {
- ones.push_back('1');
- }
- }
- int f=0;
- for (int i=0; i<s.size(); i++) {
- if (s[i]=='1') {
- continue;
- }
- if (s[i]=='2' && !f) {
- f++;
- cout << ones;
- }
- cout << s[i];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment