Java simple
\npublic int lengthOfLongestSubstring(String s) {\n        int start = 0;\n        int end = 0;\n        int max = 0;\n        Set<Character> set = new HashSet<
```\npublic int lengthOfLongestSubstring(String s) {\n        int start = 0;\n        int end = 0;\n        int max = 0;\n        Set<Character> set = new HashSet<>();\n        while (end < s.length()) {\n            if (!set.contains(s.charAt(end))) {\n                set.add(s.charAt(end));\n                end++;\n                max = Math.max(set.size(), max);\n            } else {\n                set.remove(s.charAt(start));\n                start++;\n            }\n        }\n\n        return max;\n    }\n```
['Java']