My code is submitted but i have a doubt

here line 20 proves that β€˜s’ is assigned to β€˜s1’ index by index but why does line 26 is not printing s1 ???

@anujsharmabadboy
Actually length of s1 string is unknown that why it’s not printing anything. What you can do is instead of write s1[k]=s[i], you can write s1+=s[i];

@shrm.abhishek.kmr

  1. but why is it making any difference ??
  2. i am assigning value index by index but still s1.length() is zero, why ??
  3. this is first time i have noticed it. is there something else like this in string or character array ??
  4. is this solution is according to the dare ??

No you just have to initialise string with some random string if you have to perform such operation.

can you explain with an example ??