consecutive char and counting

how to put 2 letters together and make them to count as 1?
provided that they must consecutive

for example:
p : count as 0
pxp : count as 0
pp : count as 1
xpxp: count as 0
ppxpp : count as 2

thanks a lot !!
Like this?
1
2
3
4
5
6
7
8
int CountConsecutiveChars(char Lookup, char* Array)
{
    int output;
    for (int i = 0; Array[i+1] != '\0'; ++i)
        if (Array[i] == Array[i+1])
            output ++;
    return output;
}
Topic archived. No new replies allowed.