sort n characters in descending order c++

#include <iostream>
#include <algorithm>

int main() {
    const int n = 10;  // Replace 10 with the desired number of characters
    char arr[n];

    // Input n characters
    std::cout << "Enter " << n << " characters: ";
    for (int i = 0; i < n; ++i) {
        std::cin >> arr[i];
    }

    // Sort characters in descending order
    std::sort(arr, arr + n, std::greater<char>());

    // Display the sorted characters
    std::cout << "Characters in descending order: ";
    for (int i = 0; i < n; ++i) {
        std::cout << arr[i] << " ";
    }

    return 0;
}