#include <bits/stdc++.h>
using namespace std;
long long dp[2][105];
void solve(string &s) {
  for (int i = 0; i < s.length() - 1; ++i) {
    dp[0][i + 1] = (s[i] == 'A') ? dp[0][i] + dp[1][i] : dp[1][i];
    if (s[i + 1] == 'B')
      dp[1][i + 1] = dp[1][i];
    else if (s[i + 1] == 'A' && s[i] == 'B')
      dp[1][i + 1] = dp[0][i];
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  s += s[0];
  long long res = 0;
  dp[0][0] = 1;
  solve(s);
  res += dp[0][s.length() - 1];
  memset(dp, 0, sizeof(dp));
  dp[1][0] = 1;
  solve(s);
  res += dp[1][s.length() - 1];
  cout << res << '\n';
  return 0;
}
