#K10856. Longest Alternating Case Substring
Longest Alternating Case Substring
Longest Alternating Case Substring
Given a string S consisting of both lowercase and uppercase English letters, your task is to find the length of the longest substring in which the case of adjacent characters alternates. In other words, no two consecutive characters should be of the same case.
For example, in the string "aAbBcCdD", every pair of adjacent characters alternates, making the entire string a valid substring with a length of 8. Conversely, in "aabbAABB", the longest substring where adjacent characters alternate has a length of 2.
Constraints: \(1 \leq |S| \leq 10^5\), where \(|S|\) denotes the length of the string.
inputFormat
The input consists of a single line containing the string S.
You should read from standard input (stdin).
outputFormat
Output a single integer representing the length of the longest alternating case substring. Write the result to standard output (stdout).
## sampleaAbBcCdD
8