为什么会a++会导致RE
#include<bits/stdc++.h>
using namespace std;
long long n, x, ans;
int a = 0;
string s;
char c;
int main(){
cin>>n>>x;
c = x + '0';
for(long long i = 0; i <= n; i++){
long long xx = i;
while(xx){
s += (xx % 10 + '0');
xx /= 10;
a++;
}
}
for(int i = 0; i <= s.size(); i++){
if(s[i] == c) ans++;
}
cout<<ans;
return 0;
}