A string \(s\) is called a good string if and only if two consecutive letters are not the same. For example, \(\texttt{abcab}\) and \(\texttt{cda}\) are good while \(\texttt{abaa}\) and \(\texttt{accba}\) are not.
You are given a string \(s\). Among all the good substrings of \(s\) ,print the size of the longest one.
Input format
A single line that contains a string \(s\) (\(1\leq |s| \leq 2 \cdot 10^5\)).
Output format
Print an integer that denotes the size of the longest good substring of \(s\).
The complete string is good so the answer is \(2\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor