#K85112. Maximum Numeric Substring
Maximum Numeric Substring
Maximum Numeric Substring
Given a string s consisting of letters and digits, your task is to find the maximum numeric value among all contiguous digit substrings of s. A numeric substring is defined as a sequence of one or more digits, and any leading zeros should be ignored when interpreting its value.
If no digits are found in the string, the output should be 0
.
For example, if s = "a123bc34d8ef34"
, the digit substrings are "123"
, "34"
, "8"
, and "34"
. The maximum among these interpreted as numbers is 123
.
You are required to read the input from stdin and print the result to stdout.
inputFormat
A single line containing the string s. The string may contain letters and digits.
outputFormat
An integer, printed on a single line, representing the maximum numeric value found in the substrings of s. If there are no digits, output 0.## sample
a123bc34d8ef34
123