My code gets a string of characters. For example \"aaabbffffdd\" A function inserts to a new string the letters and the amount of times they appear. So the output for this specifi
You are right, the problem is the line:
shorttxt[j + 1] = count;
Change it to:
shorttxt[j + 1] = count + '0';
And you should be fine.
The reason is that you don't want the number itself in the string, but the character representing the number. Adding the ascii value for the character 0 to the actual number gives you the correct result.