#K96007. Longest Alternating Substring

    ID: 38990 Type: Default 1000ms 256MiB

Longest Alternating Substring

Longest Alternating Substring

Given a string T containing characters (typically 'O' and 'X'), an alternating substring is defined as a substring in which every two consecutive characters are different. Your task is to compute the length of the longest alternating substring of T.

For example, in the string OXOXOX the entire string is alternating, so the answer is 6. In the string OOO, any alternating substring has a length of 1. The answer should be computed and output as a single integer.

Note: When comparing adjacent characters at positions i and i-1 in the substring, the alternating condition is satisfied if T[i] \neq T[i-1].

inputFormat

The input consists of a single line containing the string T.

outputFormat

Output a single integer, which is the length of the longest alternating substring found in T.

## sample
OXOXOX
6