#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
char S[maxn];
int n, d[maxn];
long long f[maxn][2];
long long Solve(int dir) {
  memset(f, 0, sizeof(f));
  f[0][dir] = 1;
  for (int i = 0; i < n - 1; i++) {
    if (d[i] == 1 && d[i + 1] == 0) f[i + 1][1] += f[i][0];
    if (d[i] == 0) f[i + 1][0] += f[i][0];
    if (d[i + 1] == 1) f[i + 1][1] += f[i][1];
    f[i + 1][0] += f[i][1];
  }
  long long ans = 0;
  if (dir == 0) {
    if (d[n - 1] == 1)
      ans += f[n - 1][1];
    else
      ans += f[n - 1][1] + f[n - 1][0];
  } else {
    if (d[0] == 0 && d[n - 1] == 1) ans += f[n - 1][0];
    if (d[0] == 1) ans += f[n - 1][1];
  }
  return ans;
}
int main() {
  scanf("%s", S);
  n = strlen(S);
  for (int i = 0; i < n; i++) d[i] = S[i] - 'A';
  long long ans = 0;
  ans += Solve(0);
  ans += Solve(1);
  cout << ans << endl;
  return 0;
}
