PLEASE TELL ERRORS IN MY CODE
STRING-STRING COMPRESSION
hi @Mayankrocks
ur code is failing on this input
aaaaassssddddffaaagggssfffgzx
expected o/p -->a5s4d4f2a3g3s2f3gzx
ur o/p --> a8s3d2f5g4sf3gzx
corrected code -->
i have a doubt that break statement will stop the loop there right so it will basically stop 2nd loop right?
yes @Mayankrocks
for(int j=i+1;j<str.size();j++)
{
if(str[i]==str[j]){
count++;
}
else{
break;
}
}
after break it will come out of this loop…
so basically if we have 2 loops and i have written break statement in 2nd loop so it will stop 2nd loop not 1st right?
ok thanks sendd feedback link
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.