#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,d[25];
ll memo[25][12][2][2];
ll dp(int x,int l,bool z,bool m){
ll &ans=memo[x][l][z][m];
if(ans!=-1) return ans;
if(x==0) return ans=1;
ans=0;
int M=(m?d[x]:9);
for(int i=0;i<=M;++i)
if(abs(i-l)>=2)
ans+=dp(x-1,(z&&(!i))?11:i,z&&(!i),m&&(i==M));
return ans;
}
ll solve(int n){
memset(memo,0xff,sizeof(memo));
int tot=1;
while(n) d[tot++]=n%10,n/=10;
return dp(tot-1,11,1,1);
}
int main(){
cin>>a>>b;
cout<<solve(b)-solve(a-1)<<endl;
return 0;
}
样例全过,却 WA 了。