
class Solution {public int lengthOfLongestSubstring(String s){int res = 0;for(int i = 0;i < s.length();i++) {boolean[] book = new boolean[300];//利用book[]来记录出现过的字符for (int j = i; j >= 0; j--) {/*** char charAt(int index) 返回指定索引处的char值。*/if (book[s.charAt(j)])//如果第j个字符出现过,退出本次循环break;book[s.charAt(j)] = true;res = Math.max(res, i - j + 1);}}return res;}}
