#K37777. Longest Contiguous 'A' Substring
Longest Contiguous 'A' Substring
Longest Contiguous 'A' Substring
Given a string S composed solely of uppercase English letters, your task is to determine the length of the longest contiguous substring that consists entirely of the letter A
.
Formally, if there exists an index i such that the substring S[i...i+k-1] is composed of exactly k
consecutive A
's, you need to find the maximum possible k
.
Note: The input string is guaranteed to contain only uppercase letters.
inputFormat
The input consists of a single line containing a string S, where S is formed only by uppercase English letters.
outputFormat
Output a single integer representing the length of the longest contiguous substring of A
in the input string.
BAAAB
3