Simple java solution
public class Solution {\n        public int lengthOfLongestSubstring(String s) {\n            Map<Character,Integer> indices = new HashMap<Character,Integer>();
    public class Solution {\n        public int lengthOfLongestSubstring(String s) {\n            Map<Character,Integer> indices = new HashMap<Character,Integer>();\n            int length = 0;\n            int start = -1;\n            int end = 0;\n            for(end=0; end < s.length(); end++){\n                char c = s.charAt(end);\n                if(indices.containsKey(c)){\n                    int newstart = indices.get(c);\n                    start = Math.max(start,newstart);\n                }\n                length = Math.max(length,end-start);\n                indices.put(c,end);\n            }\n            return length;\n        }\n    }
['Java']