public static int getResult(String input) { int result = 0; if (null != input && !"".equals(input)) { char[] c = input.toCharArray(); Map<Character, Integer> map = new LinkedHashMap<>(); for (int i = 0; i < c.length; i++) { map.put(c[i], 1); for (int j = i + 1; j < c.length; j++) { if (map.containsKey(c[j])) { break; } map.put(c[j], 1); } result = Math.max(result, map.size()); map.clear(); } } return result; }
01-20