cswork / OAOpen practice workspace

PayPayOA #3

Find Maximum Two-Digit Fragment

Estimated EasyJudge-ready

Topics (AI-labelled)Strings

Among all contiguous fragments of length 2 in a digit string, find the maximum value when each fragment is interpreted as a decimal number.

Input

One line containing a digit string S of length 2..100000, consisting only of the characters 0..9.

Output

Output the value of the largest two-digit fragment; a leading zero is parsed as an integer.

Example 1

Input:

50552

Output:

55

Example notes

Derive a linear scan/dynamic programming solution directly from the problem rules; the examples have been checked one by one against an independently built oracle.

Editorial

Loading solution…