#P15853. [蓝桥杯第二届国际赛] 特殊日期
[蓝桥杯第二届国际赛] 特殊日期
Problem Description
A date consists of year, month, and day. The year has four digits, the month has at most two digits, and the day has at most two digits. Xiaoming likes to write the year, month, and day together as one number. When the month or day has only one digit, he pads a in front, forming an eight-digit number.
For example, January , is written as , and November , is written as .
Xiaoming found that when written this way, some dates contain consecutive identical digits. Xiaoming calls such dates special dates. For example, is such a number, because it contains consecutive 's in the middle. Of course, November , is also such a date.
Given a start date and an end date, please calculate how many special dates there are between these two dates (including both dates).
Input Format
The input has two lines. The first line contains an eight-digit number representing the start date, and the second line contains an eight-digit number representing the end date.
Output Format
Output one line containing an integer, indicating how many special dates there are.
20181101
20181130
10
Hint
The given dates are guaranteed to be valid dates. The year ranges from to . The end date will not be earlier than the start date.
Translated by ChatGPT 5