#C12223. Longest Consecutive 'A' Sequence
Longest Consecutive 'A' Sequence
Longest Consecutive 'A' Sequence
You are given a string s
consisting of uppercase English letters. Your task is to determine the length of the longest contiguous subsequence where the character is 'A'
.
More formally, if we define a subsequence of consecutive characters in s
as a segment, you need to find the maximum length among all segments that consist solely of the character 'A'
. In mathematical terms, if we denote a segment starting at index i and ending at index j (inclusive) by s[i..j]
, then you need to compute:
$$\max_{\{i,j:\, s[k]=A\,\forall k\in[i,j]\}} (j-i+1)$$
If no such segment exists, the answer is 0
.
inputFormat
The input is provided via standard input (stdin) and consists of a single line containing the string s
.
outputFormat
Output the length of the longest consecutive sequence of 'A'
in s
through standard output (stdout).
A
1