Sir following code is giving correct answer for some test cases.But i think the code is correct.
Please tell me where is the error.
link -https://ide.codingblocks.com/s/74959
Wrong answer in some test cases in string compression problem
Rishabh, can you plz share the question as well since i m not able to understand why you have opted for prime method in string compression ?
Sorry i sent you the wrong link.
question-Take as input S, a string. Write a function that does basic string compression. Print the value returned. E.g. for input “aaabbccds” print out a3b2c2d1s1.
Instead of maintaining a frequency array, you can maintain a counter and apply the condition
while (str[i]==str[i+1])
{
cnt++;
i++;
}
Try with this logic