#K80052. Reverse Alphabetical Sorting of Rock Samples
Reverse Alphabetical Sorting of Rock Samples
Reverse Alphabetical Sorting of Rock Samples
You are given a string of uppercase letters, each representing a unique rock sample. Your task is to sort the letters in reverse alphabetical order and output the resulting string.
This problem requires you to implement a function that sorts the input string using the rule of reverse lexicographical order. For example, if the input is CBDAFE
, the output should be FEDCBA
.
Note: The comparison between characters follows standard lexicographical order. In mathematical notation, if the input string is denoted by \( S = s_1s_2\cdots s_n \), then the output should be \( S' = s_{\pi(1)}s_{\pi(2)}\cdots s_{\pi(n)} \) with \( s_{\pi(i)} \geq s_{\pi(i+1)} \) for all valid \( i \).
inputFormat
The input consists of a single line containing a non-empty string of uppercase letters without spaces.
outputFormat
Output a single line containing the string sorted in reverse alphabetical order.
## sampleA
A