#K62782. Polite Message Transformation
Polite Message Transformation
Polite Message Transformation
In this problem, you are given a message string S. Your task is to output a transformed version of the message based on the following rule:
If S is composed entirely of uppercase letters (ignoring digits and non-alphabetical characters), then transform S into a format where the first character remains uppercase and all subsequent alphabetical characters are converted to lowercase. In mathematical notation, if (S = s_1s_2...s_n) and (\forall i) for which (s_i) is an alphabet letter, (s_i) is uppercase, then output (S' = s_1' s_2'...s_n'), where (s_1' = \text{Upper}(s_1)) and for every (i \ge 2), (s_i' = \text{Lower}(s_i)). If S is not entirely in uppercase, output S unchanged.
Note: If the input is empty, output an empty string.
inputFormat
The input consists of a single line which contains the message string S.
outputFormat
Output a single line containing the transformed message according to the rule described above.## sample
HELLO WORLD!
Hello world!