#include <bits/stdc++.h>
long long f[105][2], ans;
char a[105];
int n;
void work(int flag) {
  memset(f, 0, sizeof(f));
  f[0][flag] = 1;
  for (int i = 0; i < n; i++)
    if (a[i] == 'B')
      if (a[i + 1] == 'B')
        f[i + 1][0] += f[i][1], f[i + 1][1] += f[i][1];
      else
        f[i + 1][0] += f[i][1], f[i + 1][1] += f[i][0];
    else if (a[i + 1] == 'B')
      f[i + 1][1] += f[i][1], f[i + 1][0] += f[i][0] + f[i][1];
    else
      f[i + 1][0] += f[i][0] + f[i][1];
  ans += f[n][flag];
}
int main() {
  scanf("%s", a), n = strlen(a), a[n] = a[0];
  work(0), work(1);
  std::cout << ans << "\n";
  return 0;
}
