#include <bits/stdc++.h>
using namespace std;
const int N = 110;
long long f[N], g[N];
char a[N];
int n;
long long Get(int x) {
  f[0] = x;
  g[0] = 1 - x;
  for (int i = 0; i < n; ++i)
    if (a[i] == 'A') {
      if (a[i + 1] == 'A')
        f[i + 1] = f[i] + g[i], g[i + 1] = 0;
      else
        f[i + 1] = f[i] + g[i], g[i + 1] = g[i];
    } else {
      if (a[i + 1] == 'A')
        f[i + 1] = g[i], g[i + 1] = f[i];
      else
        f[i + 1] = g[i], g[i + 1] = g[i];
    }
  return x ? f[n] : g[n];
}
int main() {
  scanf("%s", a);
  n = strlen(a);
  a[n] = a[0];
  printf("%I64d\n", Get(1) + Get(0));
}
