#include<stdio.h>
#include<string.h>
int main()
{
char s[20],o[20],temp;
int i=0,j=0,c=0;
gets(s);
while(s[i]!=NULL)
{
temp=s[i];
while(s[i]== temp)
{
i++;
c++;
}
o[j++]=temp;
o[j++]=c+48;// ASCII of 0 is 48
c=0;
}// end of while
if(strlen(o)<strlen(s))
puts(o);
else
puts(s);
return 0;
}
No comments:
Post a Comment