String Compression problem

This is my code can somneone help me with this

hi @akshat42bajpai
move the if statement above… ie if s.size() == 1, print ans and return directly from there… else go in the for loop…
corrected code … its passing all test cases now–>

it isn’t passing two test cases vaibhav can you help??

hi @akshat42bajpai
its passing all test cases… try submitting again…

https://ide.codingblocks.com/s/646296 this is my code for this problem the code you sent was for another string compression

hi @akshat42bajpai
i tried the code u just sent on all the 4 test cases which are there for this problem individually, all are giving the right o/p. maybe there is some issue from backend that’s why code is not passing all test cases… so don’t worry u can move ahead with other questions…

no no wait this is a different question … in this question if the string is “aaabbccds” then the output should be “a3b2c2ds” …if the character is coming once then we don’t have to print 1 …according to this i have sent you the code now you can help me easily that what i am doing wrong

wait i have done the question thanks for the help

1 Like

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.