#P15853. [蓝桥杯第二届国际赛] 特殊日期

    ID: 17923 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>字符串2018枚举蓝桥杯国赛

[蓝桥杯第二届国际赛] 特殊日期

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 00 in front, forming an eight-digit number.

For example, January 33, 20182018 is written as 2018010320180103, and November 1515, 20182018 is written as 2018111520181115.

Xiaoming found that when written this way, some dates contain 33 consecutive identical digits. Xiaoming calls such dates special dates. For example, 2018111520181115 is such a number, because it contains 33 consecutive 11's in the middle. Of course, November 1111, 20112011 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 19001900 to 99999999. The end date will not be earlier than the start date.

Translated by ChatGPT 5