I'm using C++. So far, my code goes like this:

```
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <windows.h>

int main() {
    char word[100]; int ctr, count = 0;
    printf("Enter string: "); gets(word);

    ctr = 1;
    while (word[ctr] != '\0') {
        if (word[ctr-1] == word[ctr]) count++;
        ctr++;
    }

    printf("%d", count);
    return 0;
}

```

Sample Run

```
Enter string: mississippi
3

Enter string: mmmmrrnzzz
6

```

I've got the first sample run correctly (mississippi) with only 3 characters appearing twice consecutively but not on the second sample run (mmmmrrnzzz) with output 6. 

My problem is that, it should not be 6 but 4 instead. 1 for the first two consecutive m, another separate 1 for the next two consecutive m, 1 for r, and 1 for z. I want a separate count for the first "mm" and the second "mm" and also for the "zz" but I don't know how.

I'm a freshman and very new to programming. I wish I could explain better. I'm hoping you could help me. Thank you.