java solution
```\nclass Solution {\n    public String greatestLetter(String s) {\n        boolean[] caps = new boolean[26];\n        boolean[] smalls = new boolean[26];\n   
```\nclass Solution {\n    public String greatestLetter(String s) {\n        boolean[] caps = new boolean[26];\n        boolean[] smalls = new boolean[26];\n        for(char ch : s.toCharArray()) {\n            if(ch >=\'a\' && ch <= \'z\')\n                smalls[ch-\'a\']=true;\n            if(ch >=\'A\' && ch <= \'Z\')\n                caps[ch-\'A\']=true;\n        }\n        char c = \'Z\';\n        for(int i = 25; i >= 0; i--,c--) {\n            if(caps[i] == true && smalls[i] == true)\n                return ""+c;\n        }\n        return "";\n    }\n}
[]