simple approach
\nclass Solution {\n    public int maxLengthBetweenEqualCharacters(String s) {\n       int largest= -1;\n        for(int i=0; i<s.length(); i++){\n            c
```\nclass Solution {\n    public int maxLengthBetweenEqualCharacters(String s) {\n       int largest= -1;\n        for(int i=0; i<s.length(); i++){\n            char current_ch= s.charAt(i);\n            int lastIndex = s.lastIndexOf(current_ch); // give last index of current_index;\n            if(lastIndex!=i){\n                largest=Math.max(largest,lastIndex-i-1);\n            }\n        }\n            \n        return largest;\n    }\n}\n```
['Java']