import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param num string字符串
* @return string字符串
*/
public String maxLexicographical(String num) {
// write code here
StringBuffer sb = new StringBuffer("");
int start = 0;
int end = 0;
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i) == '0') {
start = i;
end = i;
while (end < num.length() && num.charAt(end) == '0') {
end++;
}
end--;
break;
}
}
for (int i = 0; i < num.length(); i++) {
if (num.charAt(i) == '0' && i >= start && i <= end) {
sb.append("1");
} else {
sb.append(num.charAt(i));
}
}
return new String(sb);
}
}