#K66107. Longest Non-Decreasing Substring

    ID: 32347 Type: Default 1000ms 256MiB

Longest Non-Decreasing Substring

Longest Non-Decreasing Substring

Given a string S, find the length of the longest substring in which the characters are in non-decreasing order. In other words, for any substring S[i...j] considered, the condition should hold: $$S[i] \le S[i+1] \le \cdots \le S[j]$$. This problem tests your ability to analyze and process strings efficiently.

For example, if S = "abc", the entire string is non-decreasing and the answer is 3. If S = "cba", no two consecutive characters are in order, so the answer is 1.

inputFormat

The input consists of a single line containing the string S. The string can include alphabets and possibly other characters. The input is read from standard input.

outputFormat

Output a single integer, which represents the length of the longest substring of S in which the characters are in non-decreasing order. The output should be written to standard output.

## sample
abc
3