Consecutive repeated words

Given a sequence of words, print the length of the longest consecutive
subsequence that only contains the first word. That is, if the sequence
is s₁, …, s_(n), print
max{j − i + 1 : 1 ≤ i ≤ j ≤ n ∧ s_(i) = s_(i + 1) = … = s_(j − 1) = s_(j) = s₁}.

Input

Input consists of a non-empty sequence of words.

Output

Print the number of words of the longest consecutive subsequence that
only contains the first word.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:16:51.690Z

© Jutge.org, 2006–2026.
https://jutge.org
