#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') positive = 0;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
long long f[105][2];
char a[105];
int n;
inline long long work(int start) {
  memset(f, 0, sizeof(f));
  f[0][start] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 'B')
      f[i][1] += f[i - 1][1];
    else if (a[i - 1] == 'B')
      f[i][1] += f[i - 1][0];
    if (a[i - 1] == 'A') f[i][0] += f[i - 1][0];
    f[i][0] += f[i - 1][1];
  }
  return f[n][start];
}
int main() {
  scanf("%s", a), n = strlen(a), a[n] = a[0];
  cout << work(0) + work(1) << endl;
  return 0;
}
