Design a data structure to store strings and their counts, with the following operations all in O(1):
inc(String key)— insert with count 1 or increment count by 1.dec(String key)— decrement count. Remove if count reaches 0.getMaxKey()— return one key with the maximum count, or"".getMinKey()— return one key with the minimum count, or"".
Example:
inc("a"), inc("b"), inc("b"), inc("c"), inc("c"), inc("c")
getMaxKey()→"c", getMinKey()→"a"