#include <bits/stdc++.h>
using namespace std;
const int MaxN = 2e5;
const int inf = 1 << 30;
inline void OPEN(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
int precnt[MaxN + 5][26];
char s[MaxN + 5];
int dp[MaxN + 5][27];
int main() {
  while (~scanf("%s", s + 1)) {
    int len = strlen(s + 1);
    for (int i = 1; i <= len; i++)
      for (int j = 0; j <= 26; j++) dp[i][j] = inf;
    dp[0][26] = 1;
    for (int i = 1; i <= len; i++) {
      int x = s[i] - 'a';
      for (int j = 0; j < 26; j++) {
        if (x == j) {
          if (dp[i - 1][j] == inf)
            dp[i][x] = min(dp[i - 1][26], dp[i][x]);
          else
            dp[i][26] = min(dp[i][26], dp[i - 1][j]);
        } else
          dp[i][x] = min(dp[i][x], dp[i - 1][j] + 1);
      }
    }
    int ans = inf;
    for (int i = 0; i <= 26; i++) {
      ans = min(ans, dp[len][i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
