An auxanometer is a device inside a medical cabinet used for measuring height. It is divided vertically into equal 1 centimeter segments. The segments are labeled differently on each side of the device. The left side is used to measure the height of an adult standing on the floor, and the right side is used to measure the height of a child standing on a footstool directly beneath the device. The segments on the left side are labeled nmin to nmax, inclusive, from bottom to top. The segments on the right side are labeled 1 to nmax-nmin+1, inclusive, from bottom to top.
Your task is to determine the number of segments where the concatenation of the number on the left and the number on the right forms a non-decreasing sequence of digits. For example, if the number on the left is 168 and the number on the right is 89, the concatenation is 16889, a non-decreasing sequence of digits. Return the number of such segments on the given auxanometer.
|