[C++] [Beginner-Friendly] Using Sorting and HashMaps
We can store all the characters in an unordered map and sort the string as we need to return greater character (Lexicographically greater). \n- Then run a loop 
- We can store all the characters in an unordered map and sort the string as we need to return greater character (Lexicographically greater). \n- Then run a loop and search of the upper case and lower case of each charater in the string. \n- Finally when the loop approaches the end, the greater element is returned if it\'s lower and upper case exists in the map, else an empty string is returned.\n```\n/*\n//used inbuilt sorting to sort the characters in lexicographic  order\nTime Complexity: O(N) + O(NlogN) = O(NlogN) \n\n//Used HashMaps to store all the characters in the string\nSpace Complexity: O(N) \n*/\nclass Solution {\npublic:\n    string greatestLetter(string s) {\n\t//storing string in a hashmap for searching in efficient time\n        unordered_map<char,int>mp;\n        string ans = "";\n        for(auto it : s){\n            mp[it]++;\n        }\n\t\t//sorting the characters Lexicographically, and so we will get greater characters towards the end\n        sort(s.begin(),s.end()); \n        for(int i=0;i<s.length();i++){\n            char u = toupper(s[i]);\n            char l = tolower(s[i]);\n\t\t\t//Check if both upper case and lower case character is present in the map or not\n            if(mp[u] && mp[l]){ \n                ans = u;\n            }\n        }\n        return ans; //Return the character if present else return empty string\n    }\n};\n```\n*Happy Coding!\uD83C\uDF89\uD83E\uDD42*\n*Please do upvote \u2B06\uFE0F if you like the solution :)*
['String', 'C', 'Sorting']