Problem mapped string

test case are not passing

Hello @naveengupta,

This because of the way you are storing the string into character array:
when you add first char of s to ch[0],
‘\0’ is added automatically by the compiler at ch[1]
This terminates the while loop.

Run the following modified code in your program to understand this better:
do{
ch[i]=s[i];
cout<<ch[i]<<endl;
i++;
}while(ch[i]!=’\0’);

First run your code for sample test case given before submitting it.

Also, consider the following while writing code:
The case when there is a 0 in the input string:
example:
1203
You have to consider:
[1,2,3]
[1,20,3]
[12,3]
only

Hope, this would help.
Give a like, if you are satisfied.

You have send a wrong code.

If you have any doubt related to mapped string, then let me know.
Else mark it as resolved.

In case you have a doubt regarding separate question. Please, ask it as separate doubt.

Give a like, if your problem is resolved.