Getting Wrong answer message while I have chaecked over all test cases. here is my code pls check it out.
#include
#include
using namespace std;
void compression(string s, int l, char unique[],int ul)
{
int count=0;
for(int i=0;i<ul;i++)
{
count =0;
for(int j=0;j<l;j++)
{
if(unique[i]==s[j])
count++;
}
cout<<unique[i]<<count;
}
}
int main() {
string s;
cin>>s;
int l = s.length();
char unique[30];
int index=0,maxx=0;
for(int i=0;i<l;i++)
{
int j;
for(j=0;j<i;j++)
{
if(s[i]==s[j])
{
break;
}
}
if(j == i)
unique[index++] = s[i];
}
unique[index] = ‘\0’;
compression(s,l,unique,index);
return 0;
}