My program should first read an entered string word and then count the amount of repeated letters.
For example, if I enter apple it should print 1, but instead it prints 4.
I suppose word[i] = word[i + 1] isn't the right way to count?
#include<stdio.h>
int main() {
    int i, j, wordLength = 0, alphabeticalSort, counter = 0, swap;
    char word[51];
    scanf("%s", word);
    while (word[wordLength] != '\0'){
        wordLength++;
    }
    ...
    for (i = 0; i < wordLength; i++){
        if (word[i] = word[i + 1])
            counter++;
    }
    printf("\nNumber of repeated letters: %d", counter);
    ...
    return 0;
}
 
     
     
     
    