-
-
Save Praful932/f67551bbbc0d58311e488acdadd4a5bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int k=0,freq=0,pos=0,c=0; | |
char no[10000]; | |
char out[20]; | |
scanf("%s",no); | |
int len=strlen(no); | |
for(int j=0;j<len;j=j+freq) | |
{ | |
freq=0; | |
int first=no[j]-48; | |
while(1) | |
{ | |
if((no[k]-48)==first) | |
freq++; | |
else | |
break; | |
k++; | |
} | |
out[pos]=freq; | |
out[pos+1]=first; | |
pos=pos+2; | |
} | |
printf("%s",out); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment