#include <bits/stdc++.h>
long long carrot[110][2];
char hug[110];
int n;
long long cnt;
inline void rabbit() {
  for (int i = 1; i <= n; i++) {
    carrot[i + 1][0] =
        (hug[i] == 'A') ? carrot[i][0] + carrot[i][1] : carrot[i][1];
    if (hug[i + 1] == 'A') {
      if (hug[i] == 'B') {
        carrot[i + 1][1] = carrot[i][0];
      }
    } else {
      carrot[i + 1][1] = carrot[i][1];
    }
  }
}
int main() {
  scanf("%s", hug + 1);
  for (n = 1; hug[n + 1] != '\0'; n++)
    ;
  hug[n + 1] = hug[1];
  carrot[1][0] = 1;
  rabbit();
  cnt += carrot[n + 1][0];
  for (int i = 1; i <= n + 1; i++) {
    carrot[i][0] = carrot[i][1];
    carrot[i][1] = 0;
  }
  carrot[1][1] = 1;
  rabbit();
  cnt += carrot[n + 1][1];
  printf("%I64d\n", cnt);
  return 0;
}
