#C655. Longest Substring Length After Deleting One Character

    ID: 50322 Type: Default 1000ms 256MiB

Longest Substring Length After Deleting One Character

Longest Substring Length After Deleting One Character

You are given a list of strings. For each string, you are required to delete exactly one character and determine the maximum length of the resulting substring. Formally, for a string s with length \(n = |s|\), the answer is \(n-1\) if \(n > 1\) and \(0\) if \(n = 1\).

Note that deleting a character means removing exactly one character from the string. The order of the remaining characters must remain the same.

Input: Multiple strings. The first line contains an integer \(T\) denoting the number of strings. Each of the next \(T\) lines contains one string.

Output: Output \(T\) integers in one line separated by space, where each integer corresponds to the maximum substring length obtainable from the given string after deleting exactly one character.

inputFormat

The input is read from standard input and is in the following format:

T
s1
s2
...
sT

Where T is the number of test strings and s1, s2, ..., sT are the strings themselves.

outputFormat

Output the result for each test case: the maximum substring length after deleting one character from each string. The results should be printed in a single line, separated by a space.

## sample
1
abcde
4

</p>