title: Counting how many letters are repeated in a string
body: <p>My program should first read an entered string <code>word</code> and then count the amount of repeated letters.</p>
  
  <p>For example, if I enter <code>apple</code> it should print <code>1</code>, but instead it prints <code>4</code>.</p>
  
  <p>I suppose <code>word[i] = word[i + 1]</code> isn't the right way to count?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  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 &lt; wordLength; i++){
          if (word[i] = word[i + 1])
              counter++;
      }
  
      printf("\nNumber of repeated letters: %d", counter);
  
      ...
  
      return 0;
  }
  </code></pre>