#C6400. Max Happiness from String Substrings

    ID: 50157 Type: Default 1000ms 256MiB

Max Happiness from String Substrings

Max Happiness from String Substrings

Given a list of strings, determine the maximum happiness of any non-empty substring for each string. The happiness of a substring is defined as the maximum ASCII value of any character within that substring. In other words, for a string S, the answer is \(\max\{\text{ord}(c) : c \in S\}\). For example, for the string "abc" with ASCII values 97, 98, and 99 respectively, the maximum happiness is 99.

The input is provided via standard input and the output should be printed to standard output.

inputFormat

The first line of input contains an integer (T) representing the number of test cases. Each of the following (T) lines contains a single string consisting solely of lowercase English letters.

outputFormat

For each test case, output a single line containing the maximum ASCII value among all the characters in the provided string.## sample

1
abc
99

</p>