import java.util.*;
import java.math.*;

// **** D1. Kirk and a Binary String (easy version) ****

public class D1 {
	static char [] in = new char [1000000];
	public static void main (String [] arg) throws Throwable {
		char [] s = next().toCharArray();
		int [] zcnt = new int [s.length];
		int [] ocnt = new int [s.length];
		int n = s.length;
		if (s[0] == '1') ocnt[0]++;
		if (s[0] == '0') zcnt[0]++;

		int lastZ = -1;
		int lastO = -1;
		for (int i = 1; i<n; ++i) {
			ocnt[i] = ocnt[i-1];
			zcnt[i] = zcnt[i-1];
			if (s[i] == '1') {
				ocnt[i]++;
				//lastO = i;
			}
			if (s[i] == '0') {
				zcnt[i]++;
				/*
				if (lastO < lastZ) zcnt[lastZ]++;
				else {
					lastZ = i;
					zcnt[lastZ] = 1;
				}
				*/
			}
		}
		int ztot = zcnt[n-1];
		int otot = ocnt[n-1];

		char [] t = new char [s.length];

		for (int i = 0; i<s.length; ++i) {
			t[i] = s[i];
			if (i != s.length-1 && s[i+1] == '0' && s[i] == '1') continue; // Can't change
			if (s[i] == '1') {
				// Try to change
				t[i] = '0';
				boolean can = true;
				int baseZ = (i==0) ? 0 : zcnt[i-1];
				int baseO = (i==0) ? 0 : ocnt[i-1];
				for (int j = i+1; j<s.length && can; ++j) {
					if (zcnt[j] - baseZ+1 > ocnt[j] - baseO) can = false;
				}
				if (!can) t[i] = '1';
			}
		}
		System.out.println(new String(t));
	}

	/************** HELPER CLASSES ***************/
    //static class HS extends HashSet<Integer>{public HS(){super();}public HS(int a){super(a);}};
	//static class AL extends ArrayList<Integer>{public AL(){super();}public AL(int a){super (a);}};
	static class Pair implements Comparable<Pair> {
		int i,j;long L; public Pair(int xx, int yy, long LL){i=xx;j=yy;L=LL;}
		public int compareTo(Pair p) { return (this.L < p.L) ? -1 : (this.L == p.L) ? this.i - p.i : 1;}
	}
	/************** FAST IO CODE FOLLOWS *****************/
	public static long nextLong() throws Throwable {
		long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;
		int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i;
	}
	public static int nextInt() throws Throwable {return (int)nextLong();}
	public static String next() throws Throwable {
		int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}
		return new String(in, 0,cptr);
	}
	/**** LIBRARIES ****/
	public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;}
	public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;}
	public static int[] sieve(int LIM) {
		int i,count = 0;
		boolean [] b = new boolean [LIM];
		for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}
		int [] primes = new int[count];
		for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;
		return primes;
	}
	public static int[] numPrimeFactors(int LIM) {
		int i,count = 0;
		int [] b = new int [LIM];
		for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}
		return b;
	}
	public static StringBuilder stringFromArray(int [] a) {
		StringBuilder b = new StringBuilder(9*a.length);
		for (int i = 0; i<a.length; ++i) {
			if (i != 0) b = b.append(' ');
			b = b.append(a[i]);
		}
		return b;
	}
	public static long modPow (long a, long n, long MOD) { long S = 1; for (;n > 0; n>>=1, a=(a*a)%MOD) if ((n & 1) != 0) S = (a*S) % MOD; return S;}
}

/* Full Problem Text:

The only difference between easy and hard versions is the length of the string.
You can hack this problem only if you solve both problems.
Kirk has a binary string s (a string which consists of zeroes and ones) of length n and he is asking you to find a binary string t of the same length which satisfies the following conditions:

 For any l and r (1 <q l <q r <q n) the length of the longest non-decreasing subsequence of the substring s_{l}s_{l+1} ... s_{r} is equal to the length of the longest non-decreasing subsequence of the substring t_{l}t_{l+1} ... t_{r};
 The number of zeroes in t is the maximum possible.
A non-decreasing subsequence of a string p is a sequence of indices i_1, i_2, ..., i_k such that i_1 < i_2 < ... < i_k and p_{i_1} <q p_{i_2} <q ... <q p_{i_k}.
The length of the subsequence is k.
If there are multiple substrings which satisfy the conditions, output any.

 */


import java.util.*;
import java.io.*;

public class Solution{

	public static Integer INT(String s){
		return Integer.parseInt(s);
	}

	public static Long LONG(String s){
		return Long.parseLong(s);
	}

	//====================================================================================================================

	public static void main(String args[]) throws IOException {

		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));	Scanner in=new Scanner(System.in); StringBuilder out=new StringBuilder();

		char ch[]=in.next().toCharArray();

		int n=ch.length;

		int seq[]=new int[n], start[]=new int[2];

		for(int i=n-1; i>=0; i--) {

			if(ch[i]=='1') {
				start[1]+=1;
				start[0]=Math.max(start[0], start[1]);
				seq[i]=start[1];
				if(i!=n-1)
					seq[i]=Math.max(start[1], seq[i+1]);
			}
			else {
				start[0]=Math.max(start[0], start[1])+1;
				seq[i]=start[0];
			}
		}

		// System.out.println(Arrays.toString(seq));
		int cnt[]=new int[2];
		for(int i=n-1; i>=0; i--)
			if(cnt[0]<seq[i]) {
				ch[i]='0';
				cnt[0]+=1;
			}
			else {
				ch[i]='1';
				cnt[1]+=1;
			}

		System.out.println(new String(ch));
	}
}


import java.io.*;
import java.util.*;

public class CP {
    public static void main(String[] args) throws Exception {
        /*new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    new Solver().solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }, "Solver", 1l << 30).start();*/

        new Solver().solve();
    }
}

class Solver {
    IO io = new IO(System.in, System.out);
    final int MAXN = 1000_006;

    void solve() throws Exception {
        int i, j, k;

        String S = io.next();
        BitSet bs = new BitSet(), marked = new BitSet();

        for (i = 0; i < S.length() - 1; ++i) {
            int a = i, b = i + 1;
            while (a >= 0 && b < S.length() && S.charAt(a) == '1' && S.charAt(b) == '0') {
                marked.set(a); marked.set(b);
                bs.set(a);
                a = marked.previousClearBit(a); b = marked.nextClearBit(b);
            }
        }

        for (i = 0; i < S.length(); ++i) io.print(bs.get(i) ? 1 : 0);
        io.println();

        io.flush();
    }
}

class IO {
    static byte[] buf = new byte[2048];
    static int index, total;
    static InputStream in;
    static BufferedWriter bw;

    IO(InputStream is, OutputStream os) {
        try {
            in = is;
            bw = new BufferedWriter(new OutputStreamWriter(os));
        } catch (Exception e) {
        }
    }

    IO(String inputFile, String outputFile) {
        try {
            in = new FileInputStream(inputFile);
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outputFile)));
        } catch (Exception e) {
        }
    }

    int scan() throws Exception {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0)
                return -1;
        }
        return buf[index++];
    }

    String next() throws Exception {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan())
            sb.append((char) c);
        return sb.toString();
    }

    int nextInt() throws Exception {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    long nextLong() throws Exception {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    void print(Object a) throws Exception {
        bw.write(a.toString());
    }

    void printsp(Object a) throws Exception {
        print(a);
        bw.write(" ");
    }

    void println() throws Exception {
        bw.write("\n");
    }

    void println(Object a) throws Exception {
        print(a);
        println();
    }

    void flush() throws Exception {
        bw.flush();
        bw.close();
    }
}


/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class KirkBinary2 implements Runnable {
    public static void main(String[] args) throws Exception {
        new Thread(null, new KirkBinary2(), ": )", 1 << 28).start();
    }

    public void run() {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        char[] s = "_".concat(sc.next()).toCharArray();
        int[][] dp = new int[2][s.length];
        long[] give = new long[s.length];
        for (int i = 1; i < s.length; i++) {
            dp[0][i] = dp[0][i - 1];
            dp[1][i] = dp[1][i - 1];
            if (s[i] == '1') {
                dp[1][i] = Math.max(dp[1][i - 1], dp[0][i - 1]) + 1;
            } else {
                dp[0][i]++;
            }
            give[i] = dp[1][i] - dp[0][i];
        }
        SegmentTree st = new SegmentTree(give);
        for (int i = 1; i < s.length; i++) {
            if (s[i] == '1') {
                long amt = st.query(i, s.length - 1);
                if (amt >= 1) {
                    s[i] = '0';
                    st.updateRange(i, s.length - 1, -1);
                }
            }
        }
        out.println((new String(s)).substring(1));
        out.close();
    }

    static class SegmentTree {
        int[] lo, hi;
        long[] arr;
        long[] tree, delta;
        int N;

        // FIX THESE
        long NEUTRAL = (long) 9e18;
        private long eval(int node) {
            return tree[node] + delta[node];
        }
        private long merge(long leftVal, long rightVal) {
            return Long.min(leftVal, rightVal);
        }
        private void pullUp(int node) {
            tree[node] = merge(eval(2 * node), eval(2 * node + 1));
        }

        public SegmentTree(long[] arr) {
            N = arr.length;
            this.arr = arr;
            lo = new int[4 * N + 1];
            hi = new int[4 * N + 1];
            tree = new long[4 * N + 1];
            delta = new long[4 * N + 1];
            buildTree(1, 0, N - 1);
        }

        private void buildTree(int node, int l, int r) {
            if (l == r) {
                tree[node] = arr[l];
                lo[node] = l;
                hi[node] = r;
            }
            else {
                lo[node] = l;
                hi[node] = r;
                int mid = (l + r) / 2;
                buildTree(2 * node, l, mid);
                buildTree(2 * node + 1, mid + 1, r);
                pullUp(node);
            }
        }

        public String toString() {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < N; i++) {
                sb.append(query(i, i) + " ");
            }
            return sb.toString();
        }

        private void pushDown(int node) {
            delta[2 * node] += delta[node];
            delta[2 * node + 1] += delta[node];
            delta[node] = 0;
        }

        public long query(int l, int r) {
            return queryHelper(1, l, r);
        }

        private long queryHelper(int node, int l, int r) {
            if (r < lo[node] || hi[node] < l) {
                return NEUTRAL;
            }
            else if (l <= lo[node] && hi[node] <= r) {
                return eval(node);
            }
            else {
                pushDown(node);
                long leftResult = queryHelper(2 * node, l, r);
                long rightResult = queryHelper(2 * node + 1, l, r);
                pullUp(node);
                return merge(leftResult, rightResult);
            }
        }

        public void updateRange(int l, int r, int val) {
            updateRangeHelper(1, l, r, val);
        }

        private void updateRangeHelper(int node, int l, int r, int val) {
            if (r < lo[node] || hi[node] < l) {
                return;
            } else if (l <= lo[node] && hi[node] <= r) {
                delta[node] += val;
            } else {
                pushDown(node);
                updateRangeHelper(2 * node, l, r, val);
                updateRangeHelper(2 * node + 1, l, r, val);
                pullUp(node);
            }
        }
    }

    static class FastScanner {
        private int BS = 1 << 16;
        private char NC = (char) 0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            } catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar() {
            while (bId == size) {
                try {
                    size = in.read(buf);
                } catch (Exception e) {
                    return NC;
                }
                if (size == -1) return NC;
                bId = 0;
            }
            return (char) buf[bId++];
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt = 1;
            boolean neg = false;
            if (c == NC) c = getChar();
            for (; (c < '0' || c > '9'); c = getChar()) {
                if (c == '-') neg = true;
            }
            long res = 0;
            for (; c >= '0' && c <= '9'; c = getChar()) {
                res = (res << 3) + (res << 1) + c - '0';
                cnt *= 10;
            }
            return neg ? -res : res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c != '.' ? cur : cur + nextLong() / cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c > 32) {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c != '\n') {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if (c > 32) return true;
            while (true) {
                c = getChar();
                if (c == NC) return false;
                else if (c > 32) return true;
            }
        }
    }

    static void ASSERT(boolean assertion, String message) {
        if (!assertion) throw new AssertionError(message);
    }

    static void ASSERT(boolean assertion) {
        if (!assertion) throw new AssertionError();
    }
}


// upsolve with rainboy
import java.io.*;
import java.util.*;

public class CF1204D2 extends PrintWriter {
	CF1204D2() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1204D2 o = new CF1204D2(); o.main(); o.flush();
	}

	void main() {
		byte[] cc = sc.next().getBytes();
		int n = cc.length;
		int[] stack = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			if (cc[i] == '1')
				cc[stack[cnt++] = i] = '0';
			else if (cnt > 0)
				cc[stack[--cnt]] = '1';
		println(new String(cc));
	}
}


import java.io.*;
import java.util.*;
public class Main {
	static BufferedReader br;
	static PrintWriter pr;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	static int sum(long n)
	{
		int ans=0;
		while(n!=0)
		{
			ans=ans+(int)(n%10);
			n=n/10;
		}
		return ans;
	}
	static long gcd(long x,long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		if(x>y)
			return gcd(x%y,y);
		else
			return gcd(x,y%x);
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		pr=new PrintWriter(new OutputStreamWriter(System.out));
		int cases=1;
		while(cases!=0)
		{
			cases--;
			char[]s=br.readLine().toCharArray();
			int n=s.length;
			char[]t=new char[n];
			int[]mark=new int[n];
			Stack<Integer>st=new Stack<>();
			for(int i=0;i<n;i++)
			{
			    if(s[i]=='1')
			    st.push(i);
			    else
			    {
			        if(st.empty())
			        continue;
			        int ind=st.pop();
			        mark[i]=1;
			        mark[ind]=1;
			    }
			}
			for(int i=0;i<n;i++)
			{
			    if(mark[i]==1)
			    t[i]=s[i];
			    else
			    t[i]='0';
			}
			System.out.println(String.valueOf(t));
		}
	}
}


import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Stack;

public class Solution {
    public static void main(String[] args) throws IOException {
        FastReader in = new FastReader(System.in);
        StringBuilder sb = new StringBuilder();
        int i,j,ch,x;
        String s=in.nextLine();
        int n=s.length();
        Stack<Integer> st=new Stack<>();
        boolean arr[]=new boolean[n];
        for(i=0;i<n;i++)
        {
            ch=s.charAt(i)-48;
            if(ch==1)
                st.push(i);
            else
            {
                if(!st.isEmpty())
                {
                    x=st.pop();
                    arr[x]=true;
                    arr[i]=true;
                }
            }
        }
        for(i=0;i<n;i++)
        {
            if(arr[i])
                sb.append(s.charAt(i));
            else
                sb.append("0");
        }
        System.out.println(sb);

    }
}
class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    String nextLine() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c != 10 && c != 13; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    char nextChar() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        return (char) c;
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}


// package Quarantine;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class KirkAndBinaryStrings {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        char c[]=br.readLine().toCharArray();
        int n=c.length;
        Stack<Integer> stack=new Stack<>();
        boolean visited[]=new boolean[n];
        for(int i=0;i<n;i++){
            if(c[i]=='1'){
                stack.push(i);
            }
            else{
                if(!stack.isEmpty()){
                    visited[stack.pop()]=true;
                }
            }
        }
        StringBuilder print=new StringBuilder();
        for(int i=0;i<n;i++){
            if(!visited[i]){
                c[i]='0';
            }
            print.append(c[i]);
        }
        System.out.println(print.toString());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.TreeMap;

public class d1  extends PrintWriter {

    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    // static Scanner s=new Scanner(System.in);
    d1 () { super(System.out); }
    public static void main(String[] args) throws IOException{
        d1  d1=new d1 ();d1.main();d1.flush();
    }
    void main() throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer sb = new StringBuffer();
        StringBuffer sb1 = new StringBuffer();
        PrintWriter out = new PrintWriter(System.out);
//        Scanner s=new Scanner(System.in);
        char[] a=s()[0].toCharArray();int n=a.length;
        int[][] dpa=new int[n][2];
        for(int i=a.length-1;i>=0;i--){
            if(a[i]=='0'){
                if(i==a.length-1){
                    dpa[i][0]=1;
                }else{
                    dpa[i][0]=Math.max(dpa[i+1][0],dpa[i+1][1])+1;
                    dpa[i][1]=dpa[i+1][1];
                }
            }else{
                if(i==a.length-1){
                    dpa[i][1]=1;
                }else{
                    dpa[i][1]=dpa[i+1][1]+1;    dpa[i][0]=dpa[i+1][0];
                }
            }
        }int[][] dp=new int[n][2];
        for(int i=n-1;i>=0;i--){
            if(a[i]=='0') {
                if(i==n-1){
                    dp[i][0]=1;
                }else{
                    dp[i][0]=Math.max(dp[i+1][0],dp[i+1][1])+1;
                    dp[i][1]=dp[i+1][1];
                }
            }else{
                if(i==n-1){
                    dp[i][0]=1;
                    a[i]='0';
                }else{
                    if(dpa[i][1]==Math.max(dp[i+1][1],dp[i+1][0])+1){
                        dp[i][0]=Math.max(dp[i+1][0],dp[i+1][1])+1;
                       a[i]='0';
                        dp[i][1]=dp[i+1][1];
                    }
                    else{
                        dp[i][1]=dp[i+1][1]+1;
                        dp[i][0]=dp[i+1][0];}
                }
            }

        }
        for(int i=0;i<n;i++){
            sb.append(a[i]);
        }
        System.out.println(sb.toString());

    }long ans;int[] vis;TreeMap<Integer,Integer> tm;HashMap<Integer,Integer> val;HashMap<Integer,Integer> maxval;
      public Pair dfs(ArrayList<Integer> [] adj,int[] a,long[] tsum,int i,long pre){
          vis[i]=1;
          if(pre+a[i]>0){
              tsum[i]=pre+a[i];
          }else{
              tsum[i]=0;
          }
          long aval=0;long bval=0;
          for(Integer j:adj[i]){
              if(vis[j]==0){
                 Pair p= dfs(adj,a,tsum,j,tsum[i]);
                 long val=p.b+a[i];
                 aval=Math.max(aval,Math.max(p.a,val));
                 bval=Math.max(bval,val);
                 if(p.a+tsum[i]>ans){
                     ans=p.a+tsum[i];
                 }
              }
          }return new Pair(aval,bval);
      }

    public void sort(int[] a,int l,int h){
        if(l==h) return;
        int mid=(l+h)/2;

        sort(a,l,mid);
        sort(a,mid+1,h);
        merge(a,l,(l+h)/2,h);
    }
    void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int[n1];
        int R[] = new int[n2];
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            }
            else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    long[] st;
    void buildtree(int i,int s,int e,long[] a){
        if(s==e){
            st[i]=a[s];
            return;
        }
        int mid=(s+e)/2;
        buildtree(2*i,s,mid,a);
        buildtree(2*i+1,mid+1,e,a);
        st[i]=Math.min(st[2*i],st[2*(i)+1]);
    }
    long query(int i,int s,int e,int qs,int qe){
        if(qs>e||qe<s) return Integer.MIN_VALUE;
        if(s>=qs&&e<=qe) return st[i];
        int mid=(s+e)/2;
        long l=query(2*i,s,mid,qs,qe);
        long r=query(2*i+1,mid+1,e,qs,qe);
        return Math.max(l,r);
    }
    void pointupdate(int i,int s,int e,int qi,long ht){
        if(s==e){
            st[i]=ht;return;
        }
        int mid=(s+e)/2;
        if(qi<=mid) pointupdate(2*i,s,mid,qi,ht);
        else pointupdate(2*(i)+1,mid+1,e,qi,ht);
        st[i]=Math.max(st[2*i],st[2*i+1]);
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }
    static long l(String ss) {
        return Long.parseLong(ss);
    }
}
class Student {
    int  l;long r;
    public Student(int l, long r) {
        this.l = l;
        this.r = r;
    }

    public String toString()
    {
        return this.l+" ";
    }
}
class Pair {
    long  a,b;
    public Pair(long a,long b){
        this.a=a;this.b=b ;
    }

}
class Sortbyroll implements Comparator<Student> {

    public int compare(Student a, Student b){
        if(a.r<b.r) return -1;
        else if(a.r==b.r){
            if(a.r==b.r){
                return 0;
            }
            if(a.r<b.r) return -1;
            return 1;}
        return 1;  }
}


//package cf581d2;
import java.io.*;
import java.util.*;

public class D {
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));
		char[] s = sc.nextLine().toCharArray();
		int[] zeroes = new int[s.length];
		int[] ones = new int[s.length];
		for(int i = 0; i < s.length; i++) {
			if(i > 0) {
				zeroes[i] = zeroes[i - 1];
				ones[i] = ones[i - 1];
			}
			if(s[i] == '0')
				zeroes[i]++;
			else
				ones[i]++;
		}
		int[] subs = new int[s.length];
		for(int i = 0; i < s.length; i++) {
			subs[i] = Math.max(zeroes[i], ones[i]);
			for(int j = 0; j < i; j++)
				subs[i] = Math.max(subs[i], zeroes[j] + ones[i] - ones[j]);
		}
		int[] zsToAdd = new int[s.length];
		for(int i = 0; i < s.length; i++)
			zsToAdd[i] = subs[i] - zeroes[i];
		for(int i = s.length - 2; i >= 0; i--)
			zsToAdd[i] = Math.min(zsToAdd[i], zsToAdd[i + 1]);
		int added = 0;
		for(int i = 0; i < s.length; i++)
			if(s[i] == '0')
				out.print('0');
			else if(zsToAdd[i] > added){
				out.print('0');
				added++;
			} else
				out.print('1');
		out.println();
		out.close();
	}
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

public class D {

	static FasterScanner sc = new FasterScanner();
	static PrintWriter out = new PrintWriter(System.out);

	static void exit() {
		out.close();
	}

	public D () {
		String in = sc.nextString();
		int n = in.length();

		Stack<Integer> stack = new Stack<>();
		for (int i = 0; i < n; i++) stack.push(i);
		Stack<Integer> s2 = new Stack<>();
		while (!stack.isEmpty()) {
			int p = stack.pop();
			if (in.charAt(p) == '1' && !s2.isEmpty() && in.charAt(s2.peek()) == '0') {
				s2.pop();
			} else {
				s2.push(p);
			}
		}
		char [] res = in.toCharArray();
		while (!s2.isEmpty()) {
			res[s2.pop()] = '0';
		}
		out.println(res);
	}

	public static void main(String[] args) {
		new D();
		exit();
	}

	static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int snumChars;

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = System.in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n, int f) {
            if (f == 0) {
                int[] arr = new int[n];
                for (int i = 0; i < n; i++) {
                    arr[i] = nextInt();
                }
                return arr;
            } else {
                int[] arr = new int[n + 1];
                for (int i = 1; i < n + 1; i++) {
                    arr[i] = nextInt();
                }
                return arr;
            }
        }

        public long[] nextLongArray(int n, int f) {
            if (f == 0) {
                long[] arr = new long[n];
                for (int i = 0; i < n; i++) {
                    arr[i] = nextLong();
                }
                return arr;
            } else {
                long[] arr = new long[n + 1];
                for (int i = 1; i < n + 1; i++) {
                    arr[i] = nextLong();
                }
                return arr;
            }
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}


import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		char[] s = sc.next().toCharArray();
		int n = s.length;
		Stack<Integer> stack = new Stack();
		for (int i = 0; i < n; i++) {
			if (s[i] == '1')
				stack.push(i);
			else if (!stack.isEmpty()) {
				s[stack.pop()] = '1';
			}

			s[i] = '0';
		}
		out.println(s);
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}


import java.util.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.*;

public class D1 {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		char[] in = br.readLine().toCharArray();
		int n = in.length;
		int[] dif = new int[n];
		for(int i = n-1; i >= 0; i--){
			if(i < n-1){
				dif[i] = dif[i+1];
			}
			if(in[i] == '1') dif[i]--;
			else dif[i]++;

			if(dif[i] < 0) dif[i] = 0;
		}
		char[] res = new char[n];
		for(int i = 0; i < n-1; i++){
			if(in[i] == '0') res[i] = '0';
			else if(dif[i+1] == 0) res[i] = '0';
			else res[i] = '1';
		}
		res[n-1] = '0';
		bw.write(res);
		bw.write("\n");
		bw.flush();
	}

}


import java.io.*;
import java.util.*;

public class D1
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    public void go() throws IOException
    {
        StringTokenizer tok = new StringTokenizer(in.readLine());
        char[] s = tok.nextToken().toCharArray();
        int n = s.length;
        int[][] dp = new int[n+1][2];
        for (int i = n-1; i >= 0; i--)
        {
            for (int e = 0; e < 2; e++)
            {
                dp[i][e] = dp[i+1][e];
                if (s[i] - '0' >= e)
                {
                    dp[i][e] = Math.max(dp[i][e], dp[i+1][s[i]-'0'] + 1);
                }
            }
        }
        int[][] dp2 = new int[n+1][2];
        for (int i = 0; i < n; i++)
        {
            dp2[i][0] = dp[i][0];
            dp2[i][1] = dp[i][1];
            if (s[i] == '1')
            {
                s[i] = '0';
                for (int e = 0; e < 2; e++)
                {
                    dp2[i][e] = dp[i+1][e];
                    if (s[i]-'0' >= e)
                    {
                        dp2[i][e] = Math.max(dp2[i][e], dp[i+1][s[i]-'0']+1);
                    }
                }
                if (Math.max(dp[i][0], dp[i][1]) != Math.max(dp2[i][0], dp2[i][1]))
                {
                    s[i] = '1';
                    dp2[i][0] = dp[i][0];
                    dp2[i][1] = dp[i][1];
                }
            }
        }
        out.println(s);

        out.flush();
        in.close();
    }

    public static void main(String[] args) throws IOException
    {
        new D1().go();
    }
}


/**
 * BaZ :D
 */

import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static void solve() throws IOException
    {
        //initIo(true);
        initIo(false);
        StringBuilder sb = new StringBuilder();
        String s = ne();
        int n = s.length();
        int max[] = new int[n];
        int max0 = 0, max1 = 0;
        for(int i=n-1;i>=0;--i) {
            if(s.charAt(i)=='0') {
                max0 = max(max0,max1)+1;
            }
            else {
                max1 += 1;
            }
            max[i] = max(max0, max1);
        }
        char ans[] = new char[n];
        max0 = max1 = 0;
        for(int i=n-1;i>=0;--i) {
            int zero = max(max1, 1+max(max0, max1));
            if(zero==max[i]) {
                ans[i] = '0';
                max0 = max(max0,max1)+1;
            }
            else {
                ans[i] = '1';
                max1 += 1;
            }
        }
        for(char c : ans) {
            pw.print(c);
        }
        pl();
        pw.flush();
        pw.close();
    }
    static void initIo(boolean isFileIO) throws IOException {
        scan = new MyScanner(isFileIO);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output.txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}


import java.io.*;
import java.util.*;

public class codeforces {
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	// The next two void functions are shuffle functions on an array.
	// This way, quick sort encounters the worst case scenario with low probability.
	// A reason for doing this is if we don't a primitive data array to an object array.
	// For safety reasons, it would be preferable to use object arrays unless doing so expends a lot of time.
	public static void shuffleLongArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; i++) {
        	long tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void shuffleIntArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; i++) {
        	int tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void main (String[] args) throws IOException {
    	MyScanner sc = new MyScanner();
    	out = new PrintWriter(new BufferedOutputStream(System.out));
    	// Write solution here.
    	String g = sc.next();
    	int y = g.length();
    	String[] z = new String[y];
    	String ans = "";
    	for (int i=0; i < y; i++) {
    		if (i != y-1 && g.charAt(i)=='1' && g.charAt(i+1) =='0') ans = ans + "1";
    		else ans = ans + "0";
    	}
    	out.println(ans);
    	out.close();
	}
}


import java.io.*;
import java.util.*;

public class codeforces {
	public static PrintWriter out;
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	// The next two void functions are shuffle functions on an array.
	// This way, quick sort encounters the worst case scenario with low probability.
	// A reason for doing this is if we don't a primitive data array to an object array.
	// For safety reasons, it would be preferable to use object arrays unless doing so expends a lot of time.
	public static void shuffleLongArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; i++) {
        	long tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void shuffleIntArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
        for (int i=0; i < n; i++) {
        	int tmp = arr[i];
        	int randomPos = i + rnd.nextInt(n-i);
        	arr[i] = arr[randomPos];
        	arr[randomPos] = tmp;
        }
	}
	public static void main (String[] args) throws IOException {
    	MyScanner sc = new MyScanner();
    	out = new PrintWriter(new BufferedOutputStream(System.out));
    	// Write solution here.
    	String g = sc.next();
    	int y = g.length();
    	String[] z = new String[y];
    	int u = 0; // number of 0's
    	for (int i=0; i < y; i++) {
    		z[i] = g.substring(i, i+1);
    		if (z[i].charAt(0)=='0') u++;
    	}
    	int[] thanks = new int[y+1];
    	thanks[y] = u;
    	for (int i=y-1; i >= 0; i--) {
    		if (z[i].charAt(0)=='1') thanks[i] = thanks[i+1] + 1;
    		else thanks[i] = thanks[i+1]-1;
    	}
    	while (true) {
    		int split = y;
    		int cap = thanks[y];
    		for (int i=y-1; i >= 0; i--) {
    			if (thanks[i] > cap) {
    				cap = thanks[i];
    				split = i;
    			}
    		}
    		if (split == y) break;
    		else {
    			z[split] = "0";
    			for (int i=y; i >= 0; i--) {
    				if (i > split) thanks[i]++;
    				else thanks[i]--;
    			}
    		}
    	}
    	String ans = "";
    	for (int i=0; i < y; i++) {
    		ans = ans + z[i];
    	}
    	out.println(ans);
    	out.close();
	}
}


import java.io.*;
import java.util.*;

public class Main {
    static int inf = (int) 1e9 + 7;
    static int n;
    static char a[];

    static void check(int num) {
        int cnt = 0;
        for(int i = num - 1;i >= 0;i--) {
            if (a[i] == '0') cnt++;
            else cnt--;
            if (cnt < 0) return;
        }
        cnt = 0;
        for(int i = num + 1;i < n;i++) {
            if (a[i] == '1') cnt++;
            else cnt--;
            if (cnt < 0) return;
        }
        a[num] = '0';
    }
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(System.out);
        a = next().toCharArray();
        n = a.length;
        for(int i = 0;i < n;i++) {
            check(i);
        }
        for(int i = 0;i < n;i++) pw.print(a[i]);
        pw.close();
    }

    static BufferedReader br;
    static StringTokenizer st = new StringTokenizer("");
    static PrintWriter pw;

    static String next() throws IOException {
        while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Diff {

	int key, value;

	Diff(int key, int value) {
		this.key = key;
		this.value = value;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "key:" + this.key + "value:" + this.value;
	}

	public static void main(String... args) throws Exception {
		Diff diff;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char s[] = br.readLine().toCharArray();
		int ans[] = new int[s.length];
		boolean in1 = false, in0 = false,f1=false;
		ArrayList<Diff> al = new ArrayList<Diff>();

		int no0 = 0, no1 = 0;
		int j = 0;
		for (int i = 0; i < s.length; i++) {
			al.add(new Diff(i, s[i] - 48));
		}
		for (int i = 0; i < al.size();) {
			diff = al.get(i);
			if (diff.value == 1) {
				for (j = i; j < al.size(); j++) {
					diff = al.get(j);
					if (no0 > no1) {
						no0--;
						j--;
						break;
					}
					if (in0 && diff.value == 1) {
						break;
					} else if (diff.value == 1) {
						in1 = true;
						no1++;
					} else {
						in1 = false;
						in0 = true;
						no0++;
					}
				}
//				System.out.println(j);
				if(no0>no1){
					no0=no1;
				}
				for (int k = j-1; k >=i+no1-no0; k--) {
					diff=al.get(k);
					ans[diff.key]=diff.value;
					al.remove(k);
				}
				if(no0==0){
					f1 = true;
				}
				in1 = false;
				in0 = false;
//				System.out.println("no0:" + no0 + "no1:" + no1);
				no0 = 0;
				no1 = 0;
			}
			if(i<al.size()&&al.get(i).value==0){
				i++;
			}
			if(f1){
				break;
			}
		}
		for (int i = 0; i < ans.length; i++) {
			System.out.print(ans[i]);
		}
	}
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);

            printf("%lld %lld %lld\n",b,c,c);

    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        if(c==d)
            printf("%lld %lld %lld\n",b,c,d);
        else
            printf("%lld %lld %lld\n",b,c,c+1);

    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        printf("%lld %lld %lld\n",b,c,d);

    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        //if( c==d)
        if(d<a+b)
        printf("%lld %lld %lld\n",a,b,d);
        else if(d<2*b)
             printf("%lld %lld %lld\n",b,b,d);
        else if(d<b+c)
             printf("%lld %lld %lld\n",b,c,d);
         else if(c+1<a+b && c!=d)
             printf("%lld %lld %lld\n",a,b,c+1);
           else if(c+1<2*b && c!=d)
             printf("%lld %lld %lld\n",b,b,c+1);
          else if(c+1<b+c && c!=d)
             printf("%lld %lld %lld\n",b,c,d);

       /* else
            if(c<2*b)
            printf("%lld %lld %lld\n",b,b,c);
            else if(c>a+b)
                printf("%lld %lld %lld\n",b,b,c);*/

    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        long long int a,b,c,d;
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        if( c==d)
        printf("%lld %lld %lld\n",b,c,d);

        else
            printf("%lld %lld %lld\n",b,c,c+1);

    }
    return 0;
}


#include<stdio.h>
int main (){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		printf("%d %d %d",b,c,c);
	}
	return 0;
}


#include<stdio.h>
int main (){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		printf("%d %d %d",b,c,d);
	}
	return 0;
}


#include<stdio.h>
int main (){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		printf("%d %d %d\n",b,c,c);
	}
	return 0;
}


#include<stdio.h>
int main (){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		printf("%d %d %d",c-1,d-1,d+1);
	}
	return 0;
}


#include<stdio.h>
int main (){
	int tc;
	scanf("%d",&tc);
	while(tc--){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		printf("%d %d %d",d-1,d,d+1);
	}
	return 0;
}


#include <stdio.h>
int main(){
    int t;
    scanf("%d\n",&t);
    for(int i=0;i<t;i++){
        int a,b,c,d;
        scanf("%d %d %d %d\n",&a,&b,&c,&d);
        printf("%d %d %d\n",b,c,c);
    }
}


#include <stdio.h>
int main(){
    int t;
    scanf("%d\n",&t);
    for(int i=0;i<t;i++){
        int a,b,c,d;
        scanf("%d %d %d %d\n",&a,&b,&c,&d);
        while(1){
            int x,y,z;
            x=b;y=b;z=c;
            if((x+y)<=z)y++;
            else {
                printf("%d %d %d\n",x,y,z);
                break;
            }
        }
    }
}


#include <stdio.h>
int main(){
    int t;
    scanf("%d\n",&t);
    for(int i=0;i<t;i++){
        int a,b,c,d;
        scanf("%d %d %d %d\n",&a,&b,&c,&d);
        if((c+d)>a)printf("%d %d %d\n",a,c,d);
        else printf("NOT POSSIBLE");
    }
}


#include<stdio.h>
int main()
{
	long long int i,t,a,b,c,d,x,y,z;
	scanf("%lld",&t);
	for(i=0;i<t;i++){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=c-1;
		}
		if(c<=d){
			z=c;
		}
		if(x+y>z || y+z>x || z+x>y){
			printf("%lld %lld %lld\n",x,y,z);
		}
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long int t,a,b,c,d,x=0,y=0,z=0;
	scanf("%d",&t);
	while(t--){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=b+2;
		}
		if(c<=d){
			z=d-2;
		}
		if(x+y>z || y+z>x || z+x>y){
			printf("%lld %lld %lld\n",x,y,z);
		}
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long int i,t,a,b,c,d,x,y,z;
	scanf("%lld",&t);
	for(i=0;i<t;i++){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=c;
		}
		if(c<=d){
			z=c;
		}
			printf("%lld %lld %lld\n",x,y,z);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long int i,t,a,b,c,d,x,y,z;
	scanf("%lld",&t);
	for(i=0;i<t;i++){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=b;
		}
		if(c<=d){
			z=d;
		}
		if(x+y>z || y+z>x || z+x>y){
			printf("%lld %lld %lld\n",x,y,z);
		}
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long int i,t,a,b,c,d,x,y,z;
	scanf("%lld",&t);
	for(i=0;i<t;i++){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=b+2;
		}
		if(c<=d){
			z=d-2;
		}
		if(x+y>z || y+z>x || z+x>y){
			printf("%lld %lld %lld\n",x,y,z);
		}
	}
	return 0;
}


#include<stdio.h>
int main()
{
	long long int i,t,a,b,c,d,x,y,z;
	scanf("%lld",&t);
	for(i=0;i<t;i++){
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		if(a<=b){
			x=b;
		}
		if(b<=c){
			y=b;
		}
		if(c<=d){
			z=d-2;
		}
		if(x+y>z || y+z>x || z+x>y){
			printf("%lld %lld %lld\n",x,y,z);
		}
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
   int t,i=0;
   int a,b,c,d;
   scanf("%d",&t);

   for(i;i<t;i++){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d\t",b);
    printf("%d\t",c);
    printf("%d",c+1);

   }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
   int t,i=0;
   int a,b,c,d;
   scanf("%d",&t);

   for(i;i<t;i++){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d ",b);
    printf("%d ",c);
     printf("%d\n",c);

   }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
   int t,i=0;
   int a,b,c,d;
   scanf("%d",&t);

   for(i;i<t;i++){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d\t",b);
    printf("%d\t",c);
     printf("%d",c);

   }
    return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="a" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/a" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/a" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <stdio.h>
#include <stdlib.h>

int main()
{
   int t,i=0;
   int a,b,c,d;
   scanf("%d",&t);

   for(i;i<t;i++){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d\t",b);
    printf("%d\t",c);

     if(c==d){
    printf("%d",c);
    }
    else{
          printf("%d",b+c-1);
    }
   }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
   int t,i=0;
   int a,b,c,d;
   scanf("%d",&t);

   for(i;i<t;i++){
    scanf("%d%d%d%d",&a,&b,&c,&d);
    printf("%d\t",b);
    printf("%d\t",c);

     if(c==d){
    printf("%d",c);
    }
    else{
          printf("%d",c+1);
    }
   }
    return 0;
}


#include<stdio.h>

int main(void){
    long long int a,b,c,d,t,k,i;

    scanf("%lld",&t);

    while(t--){
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    i=b;

    printf("%lld %lld %lld\n",b,c,d);

    }
}
/*if(a+b<=d){
        for(i=c;i>b;i--){
            if(a+i>d)break;
        }
        if(a+b<=d && a!=b){
            a=b;
            i=c;
        }
   }*/


#include<stdio.h>

int main(void){
    long long int a,b,c,d,t,k,i;

    scanf("%lld",&t);

    while(t--){
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

    printf("%lld %lld %lld\n",b,c,c);

    }
}
/*if(a+b<=d){
        for(i=c;i>b;i--){
            if(a+i>d)break;
        }
        if(a+b<=d && a!=b){
            a=b;
            i=c;
        }
   }*/


#include<stdio.h>

int main(void){
    long long int a,b,c,d,t,k;

    scanf("%lld",&t);

    while(t--){
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

    if(a==1 && b==1)k=c+2;
    else{
        k=c+1;
        if(a==1)a++;
    }
    printf("%lld %lld %lld\n",a,c,k);

    }
}


#include<stdio.h>

int main(void){
    long long int a,b,c,d,t;

    scanf("%lld",&t);

    while(t--){
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

    printf("%lld %lld %lld\n",a,b,d);

    }
}


#include<stdio.h>

int main(void){
    long long int a,b,c,d,t,k,i;

    scanf("%lld",&t);

    while(t--){
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    i=b;

    if(b==c){
        printf("%lld %lld %lld\n",b,b,b);
        continue;
    }

    printf("%lld %lld %lld\n",b,c,d);

    }
}
/*if(a+b<=d){
        for(i=c;i>b;i--){
            if(a+i>d)break;
        }
        if(a+b<=d && a!=b){
            a=b;
            i=c;
        }
   }*/


#include <stdio.h>

int main(){

	int t, a, b, c, d;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d%d%d", &a, &b, &c, &d);
		printf("%d %d %d\n",b, c, c);
	}

	return 0;

}


#include <stdio.h>

int main(){

	int t, a, b, c, d;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d%d%d", &a, &b, &c, &d);
		printf("%d %d %d\n",b, c, d);
	}

	return 0;

}


#include <stdio.h>

int min(int a, int b){
	return a < b ? a : b;
}

int main(){

	int t, a, b, c, d;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d%d%d", &a, &b, &c, &d);
		printf("%d %d %d\n",a, b, min(a+b-1, c));
	}

	return 0;

}


#include <stdio.h>

int max(int a, int b){
	return a > b ? a : b;
}

int main(){

	int t, a, b, c, d;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d%d%d", &a, &b, &c, &d);
		printf("%d %d ",a, b);
		printf("%d\n", d);
	}

	return 0;

}


#include<stdio.h>
int main()
{
    long long int t,a,b,c,d;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        printf("%lld %lld %lld",b,c,c);
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    long long int t,a,b,c,d;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        printf("%lld %lld %lld",a,b,c);
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    long long int t,a,b,c,d;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        printf("%lld %lld %lld",b,b,c);
        printf("\n");
    }
    return 0;
}


#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		long long a,b,c,d;
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		long long t1=a,t2=b,t3=c,t4=d;
		long long m1,m2,m3;
		while(1){
			m1=(t1+t2/2);
			m2=(t2+t3/2);
			m3=(t3+t4/2);
		if(t1+t2>t3){
			printf("%lld %lld %lld\n",t1,t2,t3);
			break;
		}
		if(m1+m2<=m3){
			t1=m1;
			t2=m2;
		}
		else{
			t3=m3;
		}
	}
	}

}


#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		long long a,b,c,d;
		scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
		long long t1=a,t2=b,t3=c,t4=d;
		long long m1,m2,m3;
		while(1){
			m1=t1+t2/2;
			m2=t2+t3/2;
			m3=t3+t4/2;
		printf("%d %d %d\n",t1,t2,t3);
		if(t1+t2>t3){
			printf("%lld %lld %lld\n",t1,t2,t3);
			break;
		}
		if(t1+t2<=t3){
			if(t1<b){
				t1=m1;
			}
			else if(t2<c){
				t2=m2;
			}
		}else{
			t3=m3;
		}
	}
	}

}


#include<stdio.h>
int main()
{
    long long int t,i;
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
        long long int a,b,c,d;
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        printf("%lld %lld% lld\n",b,c,c);
    }
}


#include<stdio.h>
int main()
{
    long long int t,i;
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
        long long int a,b,c,d;
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        printf("%lld%lld%lld\n",b,c,c);
    }
}


#include<stdio.h>
int main()
{
    int t,i;
    scanf("%d",&t);
    for(i=0;i<=t;i++)
    {
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        if(a<=b&&b<=c&&c<=d)
         {
            printf("%d%d%d",b,c,c);
        }
    }
}


#include<stdio.h>
int main()
{
    int t,i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        long long int a,b,c,d;
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        printf("%lld%lld%lld\n",b,c,c);
    }
}


#include<stdio.h>
int main()
{
    int t,i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        printf("%d%d%d\n",b,c,c);
    }
}


#include <stdio.h>

int main()
{
    long long int t,a,b,c,d,x,y,z;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        x=b;y=c;z=c;
        printf("%lld %lld %lld\n",x,y,z);
    }
    return 0;
}


#include <stdio.h>

int main()
{
    long long int t,a,b,c,d,x,y,z;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        x=b;y=c;z=c;
        printf("%d %d %d\n",x,y,z);
    }
    return 0;
}


#include <stdio.h>

int main()
{
    long long int t,a,b,c,d,x,y,z;
    scanf("%lld",&t);
    while(t--)
    {
        scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
        x=a;y=b;z=c;
        printf("%d %d %d\n",x,y,z);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void test_case() {
    int a, b, c, d;
    int x, y, z;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    printf("%d %d %d\n", b, c, c);
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        test_case();
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void test_case() {
    int a, b, c, d;
    int x, y, z;
    scanf("%d %d %d %d", &a, &b, &c, &d);

    srand(time(0));
    x = (rand() % (b - a + 1)) + a;
    do {
        y = (rand() % (c - b + 1)) + b;
        z = (rand() % (d - c + 1)) + c;
    } while (x + y < z);
    printf("%d %d %d\n", x, y, z);
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        test_case();
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>

void test_case() {
    int a, b, c, d;
    int x, y, z;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    x = (rand() % (b - a + 1) + a);
    y = (rand() % (c - b + 1) + b);
    z = (rand() % (d - c + 1) + c);
    printf("%d %d %d", x, y, z);
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        test_case();
    }

    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>

void test_case() {
    int a, b, c, d;
    int x, y, z;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    x = (rand() % (b - a + 1) + a);
    y = (rand() % (c - b + 1) + b);
    z = (rand() % (d - c + 1) + c);
    printf("%d %d %d\n", x, y, z);
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int i = 0; i < t; i++) {
        test_case();
    }

    return 0;
}


#include<stdio.h>
int main()
{
       long long int t,a,b,c,x,y,z,i;
       scanf("%lld",&t);
       while(t--){
              scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
              for(i=1;i>0;i++){
                     if(i>=a&&i<=b) x=i;
                     if(i>=b&&i<=c) y=i;
                     if(i>=c&&i<=d) z=i;
                     if((x+y)>z&&(y+z)>x&&(z+x)>y)
                           break;
              }
              printf("%lld %lld %lld\n",x,y,z);
       }
       return 0;
}


#include<stdio.h>
int main()
{
       long long int t,a,b,c;
       scanf("%lld",&t);
       while(t--){
              scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
              printf("%lld %lld %lld\n",b,c,c);
       }
       return 0;
}


#include<stdio.h>
int main()
{
       long long int t,a,b,c,d;
       scanf("%lld",&t);
       while(t--){
              scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
              printf("%lld %lld %lld\n",b,c,c);
       }
       return 0;
}


#include<stdio.h>
int main()
{
       long long int t,a,b,c,x,y,z,i;
       scanf("%lld",&t);
       for(i=1;i<=t;i++){
              scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
              for(i=1;i>0;i++){
                     if(i>=a&&i<=b)
                          x=i;
                     if(i>=b&&i<=c)
                          y=i;
                     if(i>=c&&i<=d)
                          z=i;
                     if((x+y)>z&&(y+z)>x&&(z+x)>y)
                           break;
              }
              printf("%lld %lld %lld\n",x,y,z);
       }
       return 0;
}


#include<stdio.h>
#include <math.h>

int main()
{
  long int t,a,b,c,d,x,y,z;

  scanf("%ld", &t);

  while(t--){
  scanf("%ld %ld %ld %ld", &a,&b,&c,&d);

  if(a <= b){
    x = b;
  }
  if(b <= c){
    y = (b+c)/2;
  }
  if(c <= d){
    z = c;
  }
  printf("%ld %ld %ld\n",x,y,z);
}

  return 0;
}


#include<stdio.h>
#include <math.h>

int main()
{
  long int t,a,b,c,d,x,y,z;

  scanf("%ld", &t);

  while(t--){
  scanf("%ld %ld %ld %ld", &a,&b,&c,&d);

  if(a <= b) x = a;
  if(b <= c) y = c;
  if(c <= d) z = c;

  printf("%ld %ld %ld\n",x,y,z);

}
return 0;
}


#include<stdio.h>
#include <math.h>

int main()
{
  long int t,a,b,c,d,x,y,z;

  scanf("%ld", &t);

  while(t--){
  scanf("%ld %ld %ld %ld", &a,&b,&c,&d);

  if(a <= b){
    x = a;
  }
  if(b <= c){

    y = c;

  }
  if(c <= d){

    z = (d+c)/2.0;

  }
  if((x+y)>z && (z+y)>x && (x+z)>y){
  printf("%ld %ld %ld\n",x,y,z);
}

}
return 0;
}


#include<stdio.h>
#include <math.h>

int main()
{
  long int t,a,b,c,d,x,y,z;

  scanf("%ld", &t);

  while(t--){
  scanf("%ld %ld %ld %ld", &a,&b,&c,&d);

  if(a <= b){
    x = a;
  }
  if(b <= c){

    y = c;

  }
  if(c <= d){

    z = (d+c)/2.0;

  }
  if((x+y)>z || (z+y)>x || (x+z)>y){
  printf("%ld %ld %ld\n",x,y,z);
}

}
return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{ int a,b,c,d,t,i;
scanf("%d",&t);
int** m=(int**) malloc (sizeof(int*)*t);
for(i=0;i<t;i++)
m[i]=(int*) malloc (sizeof(int)*3);
for(i=0;i<t;i++)
{scanf("%d %d %d %d",&a,&b,&c,&d);
m[i][1]=++a;
m[i][2]=++b;
m[i][3]=++c;}
for(i=0;i<t;i++)
printf("%d %d %d\n",m[i][1],m[i][2],m[i][3]);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{ long long unsigned int  a,b,c,d;
int t,i;
scanf("%d",&t);
int** m=(int**) malloc (sizeof(long long unsigned int*)*t);
for(i=0;i<t;i++)
m[i]=(int*) malloc (sizeof(long long unsigned int)*3);
for(i=0;i<t;i++)
{scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
m[i][1]=b;
m[i][2]=b;
m[i][3]=c;}
for(i=0;i<t;i++)
printf("%d %d %d\n",m[i][1],m[i][2],m[i][3]);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{ long long unsigned int  a,b,c,d;
int t,i;
scanf("%d",&t);
int** m=(int**) malloc (sizeof(long long unsigned int*)*t);
for(i=0;i<t;i++)
m[i]=(int*) malloc (sizeof(long long unsigned int)*3);
for(i=0;i<t;i++)
{scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
m[i][1]=b;
m[i][2]=c;
m[i][3]=c;}
for(i=0;i<t;i++)
printf("%d %d %d\n",m[i][1],m[i][2],m[i][3]);
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        if((a + b) > c)
            printf("%lld %lld %lld\n", a, b, c);
        else if((a + b) > d)
            printf("%lld %lld %lld\n", a, b, d);
        else if((b + c) > a)
            printf("%lld %lld %lld\n", c, b, a);
        else if((b + c)> d)
            printf("%lld %lld %lld\n", d, b, c);
        else if((c + d) > a)
            printf("%lld %lld %lld\n", a, c, d);
        else if((c + d)> b)
            printf("%lld %lld %lld\n", d, b, c);
        else if((d + a) > b)
            printf("%lld %lld %lld\n", a, b, d);
        else if((d + a) > c)
            printf("%lld %lld %lld\n", a, c, d);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    int t;
    long long int a, b, c, d, x, y, z;

    scanf("%d", &t);
    while(t--)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

         printf("1 %lld %lld\n", c, c);

    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        if(c >= b && d >= c)
            printf("%lld %lld %lld\n", b, b, b);
        else
            printf("%lld %lld %lld\n", b, c, d);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, x, d, z, y;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        y = sqrt((c*c)+(b*b));
        z = sqrt((c*c)+(a*a));
        x = sqrt((b*b)+(a*a));
        if(y <= d)
            printf("%lld %lld %lld\n", b, c, y);
        else if(z <= d)
            printf("%lld %lld %lld\n", a, c, z);
        else
            printf("%lld %lld %lld\n", a, b, x);
        }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        printf("%lld %lld %lld\n", a, b, c);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    int t;
    long long int a, b, c, d, x, y, z;

    scanf("%d", &t);
    while(t--)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        y=(c-b)/2;
        y+=b;
        z=(c-b)/2;
        z+=c;
        printf("%lld %lld %lld\n", a, y, z);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        printf("%lld %lld %lld\n", b, c, d);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, x, d, z, y;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        y = sqrt((c*c)+(b*b));
        z = sqrt((c*c)+(a*a));
        x = sqrt((b*b)+(a*a));
        if(y <= d)
            printf("%lld %lld %lld\n", b, c, y);
        else if(z <= d)
            printf("%lld %lld %lld\n", a, c, z);
        else if( x <= d)
            printf("%lld %lld %lld\n", a, b, x);
        else
             printf("%lld %lld %lld\n", b, c, d);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        printf("%lld %lld %lld\n", ((a+b)/2), ((b+c)/2), ((c + d)/2));
    }
    return 0;
}


#include<stdio.h>

int main()
{
    long long int t, i, a, b, c, d, z, y;

    scanf("%lld", &t);

    for(i = 1; i <= t; i++)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

        y = sqrt((c*c)+(b*b));
        z = sqrt((c*c)+(a*a));
        if(y <= d)
            printf("%lld %lld %lld\n", b, c, y);
        else
            printf("%lld %lld %lld\n", a, c, z);
    }
    return 0;
}


#include<stdio.h>

int main()
{
    int t;
    long long int a, b, c, d, x, y, z;

    scanf("%d", &t);
    while(t--)
    {
        scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

         printf("%lld %lld %lld\n",a , c, c);

    }
    return 0;
}


#include <stdio.h>
int test(int a,int b, int c,int d){
	int i,j,k;
		for(i=a;i<=b;i++){
			for(j=b;j<=c;j++){
				for(k=c;k<=d;k++){
					if(i+j>k){
						printf("%d %d %d\n",i,j,k);
						return 0;
					}
				}
			}
		}
		return 0;
}
int main(){
	int t,m;
	scanf("%d",&t);
	for(m=0;m<t;m++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		test(a,b,c,d);
	}
	return 0;
}


#include <stdio.h>
int test(int a,int b, int c,int d){

	if(a+b>c){
		printf("%d %d %d\n",a, b, c);
		return 0;
	}
	if(b+b>c){
		printf("%d %d %d\n",b, b, c);
		return 0;
	}
	if(b+c-1>c){
		printf("%d %d %d\n",b, c-1, c);
		return 0;
	}
	printf("%d %d %d\n",b, c, c);
	return 0;
}
int main(){
	int t,m;
	scanf("%d",&t);
	for(m=0;m<t;m++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		test(a,b,c,d);
	}
	return 0;
}


#include <stdio.h>
int main(){
	int t,m;
	scanf("%d",&t);
	for(m=0;m<t;m++){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		int i,j,k;
		for(i=a;i<=b;i++){
			for(j=b;j<=c;j++){
				for(k=c;k<=d;k++){
					if(i+j>k){
						printf("%d %d %d\n",i,j,k);
						return 0;
					}
				}
			}
		}
	}
	return 0;
}


#include<stdio.h>
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
long long a,b,c,d,x,y,z;
scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
long long i,j,k;
for(i=a;i<=b;i--){
	for(j=b;j<=c;j--){
		for(k=c;k<=d;k--){
			if(i+j>k&&j+k>i&&i+k>j){
				printf("%lld %lld %lld\n",i,j,k);
				x=1;
				break;
		}
		if(x==1)break;}
		if(x==1)break;}
		if(x==1)break;}
	}
					return 0;
}


#include<stdio.h>
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
long long a,b,c,d,x,y,z;
scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
long long i,j,k;
for(i=b;i>=a;i++){
	for(j=c;j>=b;j++){
		for(k=d;k>=c;k++){
			if(i+j>k&&j+k>i&&i+k>j){
				printf("%lld %lld %lld\n",i,j,k);
				x=1;
				break;
		}
		if(x==1)break;}
		if(x==1)break;}
		if(x==1)break;}
	}
					return 0;
}


#include<stdio.h>
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
long long a,b,c,d,x,y,z;
scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
long long i,j,k;
for(i=b;i>=a;i++){
	for(j=c;j>=b;j++){
		for(k=d;k>=c;k++){
			if(i+j>k&&j+k>i&&i+k>j){
				printf("%lld %lld %lld\n",i,j,k);
				x=1;
				break;
		}
		if(x==1)break;}
		if(x==1)break;}
		if(x==1)break;}
		if(x==1)break;}
					return 0;
}


#include<stdio.h>
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
long long a,b,c,d,x,y,z;
scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
long long i,j,k;
for(i=b;i>=a;i--){
	for(j=c;j>=b;j--){
		for(k=c;k<=d;k++){
			if(i+j>k&&j+k>i&&i+k>j){
				printf("%lld %lld %lld\n",i,j,k);
				x=1;
				break;
		}
		if(x==1)break;}
		if(x==1)break;}
		if(x==1)break;}
	}
					return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d",&b,&c,&d);
        printf("%d %d %d\n",b,c,d);
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d%d",&b,&c,&d,&e);
        printf("%d%d%d\n",c,d,e);
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d%d",&b,&c,&d,&e);
        printf("%d %d %d\n",c,d,d);
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d%d",&b,&c,&d,&e);
        printf("%d%d%d\n",c,d,d);
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d",&b,&c,&d);
        printf("%d%d%d\n",b,c,d);
        a--;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e;
    scanf("%d",&a);
    while(a>0)
    {
        scanf("%d%d%d%d",&b,&c,&d,&e);
        printf("%d %d %d\n",c,d,e);
        a--;
    }
    return 0;
}


#include<stdio.h>
int main()
    {
        int t;
        scanf("%d",&t);
        long long int a,b,c,d;
        while(t--)
        {
            scanf("%lld %lld %lld %lld\n",&a,&b,&c,&d);
            printf("%lld %lld %lld\n",b,c,c);
        }
    }


    #include<stdio.h>
    int main()
    {
        int t;
        scanf("%d",&t);
        long long int a,b,c,d;
        while(t--)
        {
            scanf("%lld %lld %lld %lld\n",&a,&b,&c,&d);
            printf("%lld %lld %lld\n",b,c,d);
        }
    }


#include<stdio.h>
int main()
{
    int t;
    long long int a,b,c,d;
    while(t--)
    {
        scanf("%lld %lld %lld %lld\n",&a,&b,&c,&d);
        printf("%lld %lld %lld\n",b,c,d);
    }
}


    #include<stdio.h>
    int main()
    {
        int t;
        long long int a,b,c,d;
        while(t--)
        {
            scanf("%lld %lld %lld %lld\n",&a,&b,&c,&d);
            printf("%lld %lld %lld\n",b,c,c);
        }
    }


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdbool.h>
#include <time.h>

/// Bismillahir Rahmanir Rahim

void solution(void)
{
    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    printf("%d %d %d\n", b, b, c);

    return ;

}

int main(void)
{
    short int t;

    scanf("%hd", &t);

    while(t--) solution();

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdbool.h>
#include <time.h>

/// Bismillahir Rahmanir Rahim

void solution(void)
{
    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    printf("%d %d %d\n", b, c, d);

    return ;

}

int main(void)
{
    short int t;

    scanf("%hd", &t);

    while(t--) solution();

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include <time.h>
//#include "BST.h"
//#include "LinkedList.h"

/// Bismillahir Rahmanir Rahim

void solution(void)
{
    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    printf("%d %d %d\n", b , c, c);

    return ;
}

int main(void)
{
    int t;

    scanf("%d", &t);

    while(t--) solution();

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdbool.h>
#include <time.h>

/// Bismillahir Rahmanir Rahim

void solution(void)
{
    int a, b, c, d;

    scanf("%d %d %d %d", &a, &b, &c, &d);

    printf("%d %d %d\n", a, b, b);

    return ;

}

int main(void)
{
    short int t;

    scanf("%hd", &t);

    while(t--) solution();

    return 0;
}


#include<stdio.h>
int main()
{
  int t;
  scanf("%d",&t);
  while(t--){

  long long a,b,c,d;
  scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
  if(a<=b<=c<=d)
  printf("%lld %lld %lld",a,b,d);
 }
  return 0;
}


#include<stdio.h>
int main()
{
  int t;
  scanf("%d",&t);
  while(t--){

  long long a,b,c,d;
 scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
 printf("%lld %lld %lld",a,b,d);
 printf("\n");

 }
 return 0;
}


#include<stdio.h>
int main()
{
  int t;
  scanf("%d",&t);
  while(t--){

  long long a,b,c,d;
  scanf("%lld%lld%lld%lld",&a,&b,&c,&d);

 printf("%lld %lld %lld",b,c,c);
 printf("\n");
 }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e6;
char buff[MAXN+5];
string input,subs;
int freq[10];

int counter(int num){
    int ret=0;
    while(num){
        ret++;
        num /= 10;
    }
    return ret;
}
string res;
bool flag;
void solve(bool taken){
    for(int i=0;i<=10;i++){

        if(!taken  &&   ((subs[0]-'0') < i  || (subs[0]-'0') == i && flag) ){
            res += subs;
            solve(1);

            return;
        }
        else if(i<=9 && freq[i]){

            char c = (i+'0');
            res += c;
            freq[i]--;
            solve(taken);
            return;
        }
    }
//    printf("%d **\n",taken);
    return ;
}
int main(){
    scanf("%s",buff);
    input = buff;

    scanf("%s",buff);
    subs = buff;

    if(input.size()==2){
        if(input[0]==1)swap(input[0],input[1]);
        printf("%c\n",input[0]);
    }

    int k;
    string sk;
    for(int i=0;i<=MAXN;i++){
        if( i == input.size() - counter(i)){
            k = i;
            break;
        }
    }
    int temp=k;
    while(temp){
        char c = ((temp%10)+'0');
        sk = c + sk;
        temp/=10;
    }

    for(int i=0;i<input.size();i++)
        freq[input[i]-'0']++;

    for(int i=0;i<subs.size();i++)
        freq[subs[i]-'0']--;

    for(int i=0;i<sk.size();i++)
        freq[sk[i]-'0']--;

      flag=0;
      char d = sk[0];
      for(int i=0;i<sk.size();i++){
           if(sk[i]<d){
              flag=1;
              break;
           }

      }
    //for(int i=0;i<=9;i++)printf("$$$ %d\n",freq[i]);

    for(int i=1;i<=9;i++){
        if( subs[0]!='0' &&  ((subs[0]-'0') < i  || (subs[0]-'0') == i && flag)  ){
            res += subs;
            solve(1);
            break;
        }
        else if(freq[i]){
            char c = (i+'0');
            res += c;
            freq[i]--;
            solve(0);
            break;
        }

    }
        printf("%s\n",res.c_str());
        return 0;

}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1;
		else chk[B[0] - '0'] = 2;
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 2) {
				cout << B;
				flag = first = 1;
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
		else if (chk[i] != 0) {
			cout << B;
			first = 1;
			flag = 1;
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0] - '0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1; // 마지막에 써야함.
		else chk[B[0] - '0'] = 2; // 처음에 써야함.
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 2) {
				cout << B;
				flag = first = 1;
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0]-'0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1; // 마지막에 써야함.
		else chk[B[0] - '0'] = 2; // 처음에 써야함.
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 1) {
				cout << B;
				flag = first = 1;
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0]-'0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1; // 마지막에 써야함.
		else chk[B[0] - '0'] = 2; // 처음에 써야함.
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 2) {
				cout << B;
				flag = first = 1;
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
	}

	if (first == 0) {
		flag = 1;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	if (A.length() == 1 && A[0] == '0') {
		cout << "0";
		return 0;
	}

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;
	for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1; // 마지막에 써야함.
		else chk[B[0] - '0'] = 2; // 처음에 써야함.
		break;
	}

	int flag = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 2) {
				cout << B;
				flag = 1;
			}
			else {
				alp[i]--;
				cout << i; break;
			}
		}
	}
	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main() {
	int alp[11] = { 0 }, chk[11] = { 0 };

	string A, B; cin >> A >> B;

	int len = A.length(), l = 1, r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c;

	for (char x : A) alp[x - '0']++;
	for (char x : B) alp[x - '0']--;

	int temp = c;

	while (temp) {
		alp[temp % 10]--;
		temp /= 10;
	}

	int sc = 0;
	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1;
		else chk[B[0] - '0'] = 2;
		sc = 1;
		break;
	}

	if (sc == 0)
		for (char x : B) alp[x - '0']++;

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (first != 0) continue;
		if (alp[i] != 0) {
			if (chk[i] == 1) {
				// 첫문자 넣을떄 비교...
				int nc = 1, tc = 0;

				for (int j = 0; j <= 9; j++)
					for (int k = 0; k < alp[j]; k++) {
						if (tc != 0) break;
						if (nc == B.length()) tc = 1;
						else if (j > B[nc] - '0') tc = 1;
						else if (j < B[nc] - '0') tc = 2;
						nc++;
					}

				if (tc == 1) {
					cout << B;
					flag = first = 1;
				}
				else {
					alp[i]--;
					first = 1;
					cout << i; break;
				}
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
		else if (chk[i] != 0) {
			cout << B;
			first = 1;
			flag = 1;
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0] - '0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) printf("%d", i);
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
			}
			else if (flag == 0) {
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
				cout << B;
			}
			else {
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
			}
		}
	}
}


#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main() {
	int alp[11] = { 0 }, chk[11] = { 0 };

	string A, B; cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c;

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	int sameflag = 0;

	for (int i = 1; i <= B.length(); i++) {
		if (i == B.length()) sameflag = 1;
		else if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1;
		else chk[B[0] - '0'] = 2;
		break;
	}

	int flag = 0;
	int first = 0;

	if (sameflag == 1) {
		for (int x : B) alp[x - '0']++;
		flag = 1;
	}

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 1) {
				// 첫문자 넣을떄 비교...
				int nc = 1, tc = 0;

				for (int j = 0; j <= 9; j++)
					for (int k = 0; k < alp[j]; k++) {
						if (tc != 0) break;

						if (nc == B.length()) {
							tc = 1; break;
						}
						if (j > B[nc] - '0') tc = 1;
						else if (j < B[nc] - '0') tc = 2;
						nc++;
					}

				if (tc == 0 && flag == 0) {
					cout << B;
					flag = first = 1;
				}
				else {
					alp[i]--;
					first = 1;
					cout << i; break;
				}
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
		else if (chk[i] != 0) {
			cout << B;
			first = 1;
			flag = 1;
		}
	}

	if (first == 0 && flag == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0] - '0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) printf("%d", i);
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <string>

using namespace std;

int main() {
	string A, B;
	int alp[11] = { 0 };
	int chk[11] = { 0 };

	cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c; // c는 자릿수

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i < B.length(); i++) {
		if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1;
		else chk[B[0] - '0'] = 2;
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 2) {
				cout << B;
				flag = first = 1;
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
		else if (chk[i] != 0) {
			cout << B;
			flag = 1;
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0] - '0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) cout << i;
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) cout << i;
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) cout << i;
				cout << B;
			}
		}
	}
}


#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main() {
	int alp[11] = { 0 }, chk[11] = { 0 };

	string A, B; cin >> A >> B;

	int len = A.length(), l = 1 , r = 9, c = 1;

	for (int i = 1; i <= 1000000; i *= 10) {
		if (l <= len - c && len - c <= r) break;
		c++;
		l *= 10; r = r * 10 + 9;
	}

	c = len - c;

	for (char x : A) alp[x - '0']++;

	if(B.length() != 1) for (char x : B) alp[x - '0']--;

	int temp = c;

	while(temp){
		alp[temp % 10]--;
		temp /= 10;
	}

	for (int i = 1; i <= B.length(); i++) {
		if(i == B.length()) chk[B[0]-'0'] = 2;
		else if (B[i] == B[0]) continue;
		else if (B[i] < B[0]) chk[B[0] - '0'] = 1;
		else chk[B[0] - '0'] = 2;
		break;
	}

	int flag = 0;
	int first = 0;

	// 첫자리!
	for (int i = 1; i <= 9; i++) {
		if (alp[i] != 0) {
			if (chk[i] == 1) {
				// 첫문자 넣을떄 비교...
				int nc = 1, tc = 0;

				for (int j = 0; j <= 9; j++)
					for (int k = 0; k < alp[j]; k++) {
						if (tc != 0) break;

						if (nc == B.length()) {
							tc = 1; break;
						}
						if (j > B[nc] - '0') tc = 1;
						else if (j < B[nc] - '0') tc = 2;
						nc++;
					}

				if (tc == 0) {
					cout << B;
					flag = first = 1;
				}
				else {
					alp[i]--;
					first = 1;
					cout << i; break;
				}
			}
			else {
				alp[i]--;
				first = 1;
				cout << i; break;
			}
		}
		else if (chk[i] != 0) {
			cout << B;
			first = 1;
			flag = 1;
		}
	}

	if (first == 0) {
		flag = 1;
		if (B.length() == 1) alp[B[0] - '0']--;
		cout << B;
	}

	// 나머지
	for (int i = 0; i <= 9; i++) {
		if (chk[i] == 0) for (int j = 0; j < alp[i]; j++) printf("%d", i);
		else {
			if (chk[i] == 1 && flag == 0) {
				cout << B;
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
			}
			else if(flag == 0){
				for (int j = 0; j < alp[i]; j++) printf("%d", i);
				cout << B;
			}
		}
	}
}