this 'll work if u i/p the string in dis manner aaabbcc(consecutive same) a3b2c2
#include<stdio.h> #include<conio.h> main() { int x=1,i=0; char a[100]; gets(a); while(a[i]!='\0') { while(a[i]==a[i+1]) { x++; i++; } printf("%c%d",a[i],x); x=1; i++; } getchar(); } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.