#include
#include
using namespace std;
void string_compression(string str)
{
int count[1000]={0};
for(int i=0;i<str.size();i++)
{
count[str[i]]++;
}
for(int i=0;i<str.size();i=i+count[str[i]])
{
cout<<str[i]<<""<<count[str[i]];
}
}
int main() {
string str;
cin>>str;
string_compression(str);
return 0;
}
My code works fine for all the cases but still I get 50 points only
Why??
Whats the error?