Preview:
auto compare = [](const std::pair<char, int>& lhs, const std::pair<char, int>& rhs) {
        return lhs.second < rhs.second;
    };

    // Create a priority queue of pairs (char, int) using the custom comparison function
    std::priority_queue<std::pair<char, int>, std::vector<std::pair<char, int>>, decltype(compare)> pq(compare);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter