← 返回 bytedance 的题目列表White and Black Stones Game
类型:online_judge
Given a string consisting of white (W) and black (B) stones, use a sliding window algorithm to find the length of the longest contiguous substring of black stones.
Input:
A string containing only 'W' and 'B', with a length not exceeding 10^5.
Output:
An integer representing the length of the longest contiguous substring of black stones.
Example:
Input 'BWBWBWBWWBB'
Output 2
Input 'BBBBBB'
Output 6
Example
Input
BWBWBWBWWBB