Given a string of English letters s, return the greatest English letter which occurs as both a lowercase and uppercase letter in s. The returned letter should be in uppercase. If no such letter exists, return an empty string.

An English letter b is greater than another letter a if b appears after a in the English alphabet.

&nbsp;
Example 1:

Input: s = "lEeTcOdE"
Output: "E"
Explanation:
The letter 'E' is the only letter to appear in both lower and upper case.


Example 2:

Input: s = "arRAzFif"
Output: "R"
Explanation:
The letter 'R' is the greatest letter to appear in both lower and upper case.
Note that 'A' and 'F' also appear in both lower and upper case, but 'R' is greater than 'F' or 'A'.


Example 3:

Input: s = "AbCdEfGhIjK"
Output: ""
Explanation:
There is no letter that appears in both lower and upper case.


&nbsp;
Constraints:


	1 &lt;= s.length &lt;= 1000
	s consists of lowercase and uppercase English letters.


class Solution:
    def greatestLetter(self, s: str) -> str:
        cnt = Counter(s)
        return next((u for u in reversed(ascii_uppercase) if cnt[u] and cnt[u.lower()]), "")
class Solution
{
    public String greatestLetter(String s)
    {
        Set<Character> set = new HashSet<>();
        for(char ch : s.toCharArray())
            set.add(ch);
        
        for(char ch = 'Z'; ch >= 'A'; ch--)
            if(set.contains(ch) && set.contains((char)('a'+(ch-'A'))))
               return ""+ch;
        return "";
    }
}
class Solution {
public:

    string greatestLetter(string s)
    {
        vector<int> low(26), upp(26); //storing occurences of lower and upper case letters
        string res = "";

        for(auto it : s) //iterate over each char and mark it in respective vector
        {
            if(it-'A'>=0 && it-'A'<26)
                upp[it-'A']++;
            else
                low[it-'a']++;
        }

        for(int i=25; i>=0; i--) //start from greater char
        {
            if(low[i] && upp[i]) //if char found in upp and low that will be the result
            {
                res += 'A'+i;
                break;
            }

        }
        return res;
    }
};
var greatestLetter = function(s) {
    let set=new Set(s.split(""));
	// ASCII(A-Z, a-z)=(65-90, 97-122).
    for(let i=90; i>=65; i--){
        if(set.has(String.fromCharCode(i)) && set.has(String.fromCharCode(i+32))){
            return String.fromCharCode(i);
        }
    }
    return "";
};
Greatest English Letter in Upper and Lower Case