Not able to compile

hey @abhisheksingh80511
commented one unbalanced β€˜}’ and copy of main() :https://ide.codingblocks.com/s/354603

If this resolves ur query then please mark it as resolved :slight_smile:

still code is not working, please check it

Hey @abhisheksingh80511
Updated ur code and mentioned the change in comment: https://ide.codingblocks.com/s/354617
But its still wrong because

say

aabaa
for this output should be a2b1a2
and ur code will give a4b1

Correct approach :

  1. Take the first character of the present string and store it in say β€˜ch’. Start iterating over the string and obtain the count of this character occurring consecutively from this point.
  2. Obtain the answer for remaining string recursively.
  3. Return ch+countOfCh+recursiveResult .

for(int i=0;i<256;i++){ if(arr[i]!=0){ cout<<(char)i<<arr[i];//updated this line } }

actually this line is very time consuming, is thier any thing that we can do with the loop of ( size of string)

and also some test case are failing in that

Instead of above u can use
for(int i=0;i<size;i++){
…if(arr[i]!=0){
. . . cout<<s[i]<<arr[s[i]];
… . arr[i]=0;
…}
}

I already told u ur logic is incorrect

Refer to this

The change I told u is according to ur logic