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