algorithms/strings/alternating-characters.c
int alternatingCharacters(char* s) {
    char c = 0;
    int deletes = 0;
    for (int i = 0; s[i]; i++) {
        if (s[i] == c) {
            deletes++;
        } else {
            c = s[i];
        }
    }
    return deletes;
}
// Complete the alternatingCharacters function below.
Complete the alternatingCharacters function below.
Complete the alternatingCharacters function below .
int alternatingCharacters(char* s) {
    char c = 0;
    int deletes = 0;
    for (int i = 0; s[i]; i++) {
        if (s[i] == c) {
            deletes++;
        } else {
            c = s[i];
        }
    }
    return deletes;
}
int alternatingCharacters ( char * s ) { char c = 0 ; int deletes = 0 ; for ( int i = 0 ; s [ i ] ; i ++ ) { if ( s [ i ] == c ) { deletes ++ ; } else { c = s [ i ] ; } } return deletes ; }
Complete the alternatingCharacters function below.
Complete the alternatingCharacters function below .