#include <stdio.h>
void *Rle(char *str)
{
int len(char*item){int t=0;while(item[t] !='\0')t++;return t;}
int si = len(str);
int st=0,c_out=0,c_in=0,p=0;
char *temp
= malloc(len
(str
)+1);
for(c_out=0;c_out<si;c_out++)
{
for(c_in=c_out;c_in<si;c_in++)
{
if(str[c_out]==str[c_in])
{
st++;
c_out=c_in;
if(c_out == si-1)
{
*(temp+p)=str[c_out];
p++;
*(temp+p)=st+'0';
p++;
*(temp+p)='\0';
}
}
else
{
temp[p]=str[c_out];
p++;
*(temp+p)=st+'0';
p++;
st=0;
c_out=c_in-1;
break;
}
}
}
return temp;
}
int main()
{
printf("%s \n",Rle
("wwwwwwiee")); printf("%s \n",Rle
("youaregoddd"));
return 0;
}