#C1100. Longest Increasing Digits Substring
Longest Increasing Digits Substring
Longest Increasing Digits Substring
Given a string s
containing letters and digits, your task is to find the longest contiguous substring consisting solely of digits which form a sequence of strictly increasing numbers. In other words, each digit (after the first in the substring) must be greater than the previous digit. If there are multiple candidate substrings, output the one with the greatest length. If no such digit substring exists, output an empty string.
Note: The sequence must be contiguous and the increasing relation is strict (i.e. equal digits do not count as increasing).
Example: For input abc1234567xyz12
, the answer is 1234567
.
inputFormat
The input consists of a single line containing the string s
. The string may include letters and digits.
The input is provided via stdin.
outputFormat
Output a single line containing the longest contiguous substring of strictly increasing digits extracted from the input string. If no such substring exists, print an empty string.
The output should be written to stdout.
## sampleabc1234567xyz12
1234567