// hw05prob2.cpp
// Assignment 5 - practice problem #2
#include <iostream>
int main()
{
const int LENGTH = 15;
// Input a word:
cout << "Enter a word (at most "
<< LENGTH << " characters):>";
char word[LENGTH+1];
cin >> word;
// Count pairs of identical adjacent characters:
int pairs = 0;
for (int i = 1; word[i] != '\0'; i++)
if (word[i] == word[i-1])
pairs++;
// Output result:
cout << pairs << " pairs of identical adjacent"
<< " characters found." << endl;
return 0;
} // main