package leetcode;

public class Task3 {

    public static void main(String[] args) {
        System.out.println(new Task3().lengthOfLongestSubstring("abcabcbb"));
        System.out.println(new Task3().lengthOfLongestSubstring("bbbbb"));
        System.out.println(new Task3().lengthOfLongestSubstring("pwwkew"));
        System.out.println(new Task3().lengthOfLongestSubstring(" "));
    }

    public int lengthOfLongestSubstring(String s) {
        int maxSize = 0;
        for (int i = 0; i < s.length(); i++) {
            int[] chars = new int[128];
            chars[s.charAt(i)]++;
            for (int j = i + 1; j < s.length(); j++) {
                if (chars[s.charAt(j)] > 0) {
                    break;
                }
                chars[s.charAt(j)]++;
            }
            int size = 0;
            for (int c : chars) {
                if (c == 1) {
                    size++;
                }
            }
            if (size > maxSize) {
                maxSize = size;
            }
        }
        return maxSize;
    }
}

@@ -528,21 +528,34 @@
   int%5B%5D 
-chars
+substringCharIndex
  = new i
@@ -567,37 +567,50 @@
 8%5D;%0A            
-chars
+substringCharIndex
 %5Bs.charAt(i)%5D++;
@@ -685,21 +685,34 @@
     if (
-chars
+substringCharIndex
 %5Bs.charA
@@ -785,21 +785,34 @@
         
-chars
+substringCharIndex
 %5Bs.charA
@@ -889,13 +889,26 @@
 c : 
-chars
+substringCharIndex
 ) %7B%0A

Add Task3