#C5349. Longest Digit Substring

    ID: 48988 Type: Default 1000ms 256MiB

Longest Digit Substring

Longest Digit Substring

You are given a string composed of alphabetic characters and digits. Your task is to find the length of the longest contiguous substring that consists solely of digits.

For example:

  • Input: "abc1234xyz98765pqrs" → Output: 5
  • Input: "abcd" → Output: 0

The problem requires you to read the input from standard input (stdin) and write the output to standard output (stdout). Make sure that your solution works for all edge cases.

inputFormat

The input consists of a single line containing a non-empty string s which comprises both digits and alphabets.

You should read the input from standard input (stdin).

outputFormat

The output should be a single integer representing the length of the longest contiguous substring that contains only digits. Write the output to standard output (stdout).

## sample
abc1234xyz98765pqrs
5