Interesting Coding 1 test case coming wrong

Could not figure out why one test case is coming wrong while all edge cases are included

int main() {

// Use ctrl+shift+b ( second option )

ios_base::sync_with_stdio(false);

cin.tie(0);

cout.tie(0);

ll t;

cin >> t;

while (t--) {

    string s;

    cin>>s;

    int n = s.length();

    vector<ll> dp(n+2,1);

    for(ll i=1;i<n;i++){

        dp[i+1] = isValid(s[i]-'0')*dp[i] + 

            isValid((s[i-1]-'0')*10 + s[i]-'0')*dp[i-1];

    }

    cout<<dp[n]<<"\n";

}

return 0;

}

Hello @aryan_007, pls consider this testcase. 122012
Your code will give 7 as an answer but actually the answer will be 4.
Pls try it once and check your logic in case you feel some error or confusion i will help you out.

can’t i count 01 as A

no, you can’t consider like this

okay thankyou sir !!