String compression problem

#include
#include
#include
using namespace std;
int main()
{
char s[1000];
cin.getline(s, 1000);
sort(s, s + strlen(s));
int count[129] = {0};
for (int i = 0; i < strlen(s); i++)
{
count[s[i]]++;
}
for (int i = 0; i < strlen(s); i++)
{

    if (s[i] != s[i - 1])
    {
        cout << s[i] << count[s[i]];
    }
}

return 0;

}

please let me know my code isnt passing all test cases in string compression problem.

i think u have misunderstood the problem .
u only have to compress consecutive same letters.

for example->
aabbbaaac
should be compressed as a2b3a3c1