#C2230. Most Frequent Characters

    ID: 45524 Type: Default 1000ms 256MiB

Most Frequent Characters

Most Frequent Characters

You are given a string. Your task is to find the most frequently occurring character(s) in the string, ignoring spaces and considering case-insensitivity for alphabetic characters. Note that non-alphabetic characters are also counted, but they should retain their original case when output.

If there is a tie among characters, return all of them in sorted order (ascending order based on their lowercase form). If the input string is empty or contains only spaces, output an empty line.

Note: When determining the frequency, all alphabetic letters are treated as lowercase. For example, 'A' and 'a' are considered the same. However, when outputting characters that are non-alphabetic, retain their original form if applicable.

Example:

Input: The rain in Spain stays mainly in the plain.
Output: i n

Input: Hello, world! Output: l

</p>

inputFormat

The input consists of a single string provided via standard input (stdin). The string may contain spaces, punctuation, and special characters. Leading and trailing whitespace should be trimmed.

outputFormat

Output the most frequent character(s) found in the string in a single line, separated by a single space. If there are no characters to output, print an empty line.

## sample
The rain in Spain stays mainly in the plain.
i n