#P6754. Count of Non-Palindromic Number Strings
Count of Non-Palindromic Number Strings
Count of Non-Palindromic Number Strings
Problem Statement:
We define a palindromic numeric string as a string of digits that reads the same forwards and backwards. In addition, if a numeric string contains \text{any substring of length } > 1 that is itself a palindrome, then the entire string is also considered a palindrome. In other words, if a numeric string does not satisfy these conditions, it is called a non-palindrome.
For example, note that any single-digit number is inherently a palindrome. For a multi-digit number, not only must the number itself not be symmetric, but none of its contiguous substrings (of length greater than 1) should be palindromic. A substring of length 2 is palindromic if both digits are the same, and a substring of length 3 is palindromic if its first and third digits are equal.
Given two integers and , count how many numbers in the interval (using their usual decimal representation with no leading zeros) are non-palindromic as defined above.
inputFormat
The input consists of two integers and separated by a space.
outputFormat
Output a single integer representing the count of non-palindromic numeric strings in the interval .
sample
1 20
10