This problem is almost the same as the next one, but has different requirement and constraints. As time flies by, the composition of our society is always changing. Where the post-1980s and post-1990s generations were almost considered as the era of the past, the reverse is true for the post-1995 and post-2000s generations: the rising of new generations is bound to bring more surprises.
In this year, the brand new post-2020s generation was recently created. On 2nd Feb 2020, it was reported by People's Daily that babies who were born in Changyi District, Jilin City, Jilin Province on this day, would receive a unique identification number only made up of digit '2' and '0'. That is mainly because the date "20200202" is a
Palindrome Date.
Nowadays, Little Gyro considers that this kind of phenomenon of
Palindrome Date is quite well-known among all the people and decides to play with it. Moreover, Little Gyro made the following new regulations on it:
- The Palindrome Date should be a valid date, according to the rules of Gregorian calendar(公历历法). Furthermore, it should satisfy the format of "YYYYMMDD", where YYYY, MM and DD represent the year, month and day, respectively.
- The Palindrome Date should conform the format of "ABCDDCBA", where A, B, C and D represent the digit number at the range of '0' to '9'. Furthermore, it is allowed to be duplicated among each of them.
Now given a series of identification number periods, Little Gyro wants to calculate the number of times if and only if a
consecutive Palindrome Date appears from these given number periods within the specific given order. Please help him.
Please note that all the
Palindrome Dates should at the range of 1st Jan, 0001 and 31st Dec, 9999 (both inclusive).