#64. 查找字符串最长连续相同字符块

    ID: 64 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatString-3gesp3字符串模拟

查找字符串最长连续相同字符块

Longest Block

Background

Congcong is playing a character game recently. He got a string of characters and wants to know the length of the longest consecutive sequence of identical characters.

Problem Description

Given a string, return the length of the largest "block" in the string. A "block" is a run of adjacent characters that are the same.

Input Format

Input is given from standard input in the following format.

A string.

Output Format

Output is printed to standard output in the following format.

An integer, representing the length of the longest block of identical characters.

Sample

hoopla
2
abbCCCddBBBxx
3

0

Sample Explanation

  • Sample 1: In the string "hoopla\