Frequency array | C++
\nclass Solution {\npublic:\n    string greatestLetter(string s) {\n        vector<int> upper(26, 0), lower(26, 0);\n        for (auto& c : s)\n            islo
```\nclass Solution {\npublic:\n    string greatestLetter(string s) {\n        vector<int> upper(26, 0), lower(26, 0);\n        for (auto& c : s)\n            islower(c) ? lower[c - \'a\']++ : upper[c - \'A\']++;\n        for (int i = 25; ~i; i--)\n            if (upper[i] && lower[i])\n                return string(1, \'A\' + i);\n        return "";\n    }\n};\n```
['C']