#C6248. Longest Digit Substring

    ID: 49987 Type: Default 1000ms 256MiB

Longest Digit Substring

Longest Digit Substring

In this problem, you are given a string ( s ) and you must determine the longest contiguous substring that consists entirely of digits. The result should be the starting index and the length of this digit substring. If there are no digits in the string, output ( -1 ) for the starting index and ( 0 ) for the length.

For example, given the string "ab1234xyz123", the longest digit substring is "1234" which starts at index 2 and has a length of 4.

inputFormat

The input consists of a single line that contains the string ( s ). The string may contain letters, digits, and other characters.

outputFormat

Print two space-separated integers: the starting index and the length of the longest contiguous substring that consists only of digits. If no such substring exists, print ( -1 ) and ( 0 ) respectively.## sample

ab1234xyz123
2 4