Easy Java Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxLengthBetweenEqualCharacters(String s) {\n        int max=-1;\n        HashMap<Character,Integer>map=new HashMap<>();\n        for(int i=0;i<s.length();i++){\n            char ch=s.charAt(i);\n            if(map.containsKey(ch)){\n                int idx=i-map.get(ch)-1;\n                max=Math.max(idx,max);\n            }else{\n                map.put(ch,i);\n            }\n        }\n        return max;\n    }\n}\n```
['Java']