C++ Solution || Simple Approach
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string greatestLetter(string str) {\n\n    unordered_set<char> s;\n    string Ans = "";\n    char temp = \' \';\n    \n    for (int i = 0; i < str.size(); i++)\n        if (str[i] >= \'a\' && str[i] <= \'z\')\n            s.insert(str[i]);\n\n    for (int i = 0; i < str.size(); i++)\n        if (str[i] >= \'A\' && str[i] <= \'Z\')\n            if (s.find(str[i] + 32) != s.end())\n                temp = max(temp, str[i]);\n            \n    if(temp!=\' \')\n        Ans+=temp;\n    \n    return Ans;\n\n    }\n};\n```
['C++']