#Lutece0428. Mountain Number
Mountain Number
Migrated from Lutece 428 Mountain Number
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
A Mountain number is defined as continuous digits {} ( and ),which exist () satisfied () and ().Such as , and so on.
Now,BlinKer is facing a problem.He wants to calculate the number of mountain numbers in the closed interva . Could you help him?
Input
First line is a integer ,which means the number of test cases.
Each case has two integers () in a single line.
Output
For each case,first output Case #x:
( start from ),then output a single num which is the answer.
Samples
3
121 121
100 101
12341 12344
Case #1: 1
Case #2: 0
Case #3: 3
Resources
2011 UESTC ACM Training for Dynamic Programming