Under construction

Still being built. Things may change

Longest Digit Run

Interview

Time limit1sMemory limit128 MB

Summary
For three given eight-digit numbers, print the length of the longest run of identical consecutive digits in each.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

You are given three positive eight-digit integers. For each integer, find the maximum length of a contiguous run made of the same digit. If no equal adjacent digits appear, the answer is 1.

For example, 12345123 has no equal adjacent digits, so its answer is 1. In 17772345, the digit 7 appears 3 times in a row, so its answer is 3. In 22233331, the digit 2 appears 3 times in a row and the digit 3 appears 4 times in a row, so its answer is 4.

Input

The first through third lines each contain one positive eight-digit integer.

Output

For each given integer, output the longest length of consecutive equal digits, one answer per line in input order.

Examples1

  1. Example 1

    Input
    12345123
    17772345
    22233331
    
    Expected output
    1
    3
    4