I have used the Hash Method and I have checked for single char string and almost everything but still it is saying that I am missing out on 2 test cases

#include <stdio.h>
#include
#include
#include
using namespace std;

int main()
{

int ar[26] = {0};
string s;
cin >> s;
for (int i = 0; i < s.length(); i++)
{
	char ch = s[i];
	int c = (int)ch - 97;
	//cout << ch;
	ar[c]++;
}
for (int i = 0; i < 26; i++)
{
	if (ar[i] != 0)
	{
		int t = 97 + i;
		cout << char(t) << ar[i];
	}
}
return 0;

}

Hello @suhaib0900 No you are doing wrong we have to compress only the consecutive same alphabets.
suppose for the test case:
aaabbccdsa ouput should be : a3b2c2d1s1a1
you need to change your approach.

Oh I misunderstood the question. I have corrected it. Thanks.

@suhaib0900 can i mark this as resolved?

Yeah Sure. You can close the thread,

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.