This function is enough to do the work. void StringCount (char *str, int strlen) { int l_iFirstIterator = 0, l_iSecondIterator = 1, l_iCount = 0;
while (l_iFirstIterator < strlen) { l_iCount = 0; while (str [l_iFirstIterator] == str [l_iSecondIterator]) { l_iSecondIterator++; l_iCount++; } printf ("%c", str [l_iFirstIterator]); if (l_iCount) { printf ("%d", l_iCount + 1); } l_iFirstIterator = l_iSecondIterator; l_iSecondIterator = l_iSecondIterator + 1; } printf ("\n"); } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/qUW6MSOaynUJ. 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.