#include <bits/stdc++.h>
int change_time = 0;
char maked_word[1000][100001] = {{'\0'}};
int temp = 0;
char *change(int t, char *s, char sw) {
  char ret[100001];
  for (int i = 0; i < t; i++) {
    ret[i] = s[i];
  }
  ret[t] = sw;
  for (int i = t + 1; s[i + 1] != '\0'; i++) {
    ret[i] = s[i + 1];
  }
  return ret;
}
void saiki(char *s) {
  strcpy(maked_word[change_time], s);
  for (int i = 0; i < change_time; i++) {
    if (strcmp(maked_word[i], s) == 0) {
      change_time -= 1;
    }
  }
  change_time++;
  int num = 0;
  for (int i = 0; s[i] != '\0'; i++) {
    num++;
  }
  for (int i = 0; i < num; i++) {
    if (s[i] == 'a' && s[i + 1] == 'a') {
      char *ss = change(i, s, 'b');
      saiki(ss);
    }
    if (s[i] == 'b' && s[i + 1] == 'b') {
      char *ss = change(i, s, 'a');
      saiki(ss);
    }
  }
}
int main(void) {
  char s[100001];
  scanf("%s", s);
  saiki(s);
  printf("%d\n", change_time);
}
