In problem recursion-codes of string

what is the problem with the following code,it is not accepting it,
even though the given sample cases are being passed,when i tried with run-code
#include<bits/stdc++.h>
using namespace std;

int ticks=0;

void finds(string s,string ans,int i)
{
if(abs(i)>=s.length())
{
if(ticks==0)
cout<<ans;
else
cout<<", "<<ans;
ticks++;
return;
}
int val=s[i]-‘0’;
char t=val+‘a’-1;
finds(s,ans+t,i+1);
if(abs(i+1)<s.length())
{
int val2=s[i+1]-‘0’;
int finval=val*10+val2;
char m=‘a’+finval-1;
finds(s,ans+m,i+2);
}
}

int main() {
string str,ans;
cin>>str;
cout<<"[";
finds(str,ans,0);
cout<<"]";
return 0;
}

In your code you have not put any check points to determine if the two digits together make a valid character.
Take the case of Input
234
Answer should be [bcd, wd]
But your code is returning [bcd, b‚, wd]
as it is considering a character corresponding to 34, whereas there is a limit to it which is 26

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.