✅C++ | ✅Use Vector | ✅Simple and Efficient Solution
TC : O(N)\nSC : O(2S)\nwhere S: total number of letters in english\n\nCode:\n\nclass Solution {\npublic:\n    \n    string greatestLetter(string s) \n    {\n   
**TC : O(N)\nSC : O(2S)**\nwhere S: total number of letters in english\n\n**Code:**\n```\nclass Solution {\npublic:\n    \n    string greatestLetter(string s) \n    {\n        vector<int> low(26), upp(26); //storing occurences of lower and upper case letters\n        string res = "";\n    \n        for(auto it : s) //iterate over each char and mark it in respective vector\n        {\n            if(it-\'A\'>=0 && it-\'A\'<26)\n                upp[it-\'A\']++;\n            else\n                low[it-\'a\']++;\n        }\n        \n        for(int i=25; i>=0; i--) //start from greater char \n        {\n            if(low[i] && upp[i]) //if char found in upp and low that will be the result\n            {\n                res += \'A\'+i; \n                break;\n            }\n                \n        }\n        return res;  \n    }\n};\n```\n\n**Please upvote if it helps :)**
['String', 'C', 'C++']