#P3413. Cute Numbers
Cute Numbers
Cute Numbers
Given two integers l and r, count the number of cute numbers in the range [l, r]. A number is called cute if it contains a palindrome substring of length at least 2. In other words, if the decimal representation of a number contains either two consecutive identical digits or a pattern where a digit repeats after one intervening digit, then the number is cute.
Formally, let the digits of a number be denoted by \(d_0, d_1, d_2, \dots, d_{n-1}\). The number is cute if there exists an index i such that either
\(d_i = d_{i+1}\)
or
\(d_i = d_{i+2}\)
For example, the number 101
is cute because although its adjacent digits are not identical, it forms a palindrome (\(1\ 0\ 1\)); the number 110
is cute because it contains the adjacent palindrome 11
; however, 102
and 1201
are not cute.
Since the answer might be very large, output it modulo \(10^9+7\).
inputFormat
The input consists of two space‐separated integers l and r.
outputFormat
Output a single integer, the count of cute numbers between l and r (inclusive) modulo \(10^9+7\).
sample
100 110
3