#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n;
char s[N];
long long ans = 0, dp[N][2];
void link() {
  for (n = 1; s[n + 1] != '\0'; ++n)
    ;
  s[n + 1] = s[1];
}
void solve() {
  for (int i = 1; i <= n; ++i) {
    dp[i + 1][0] = (s[i] == 'A') ? dp[i][0] + dp[i][1] : dp[i][1];
    if (s[i + 1] == 'A') {
      if (s[i] == 'B') {
        dp[i + 1][1] = dp[i][0];
      }
    } else
      dp[i + 1][1] = dp[i][1];
  }
}
int main() {
  scanf("%s", s + 1);
  link();
  dp[1][0] = 1;
  solve();
  ans = dp[n + 1][0];
  for (int i = 1; i <= n + 1; ++i) dp[i][0] = dp[i][1] = 0;
  dp[1][1] = 1;
  solve();
  ans += dp[n + 1][1];
  printf("%lld\n", ans);
  return 0;
}
