#include <bits/stdc++.h>
using namespace std;
using lld = int64_t;
const int N = 100 + 5;
lld dp[N][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int n = static_cast<int>(s.size());
  function<void()> calc = [&n, &s]() {
    for (int i = 1; i < n; ++i) {
      if (s[i - 1] == 'A' and s[i] == 'A') {
        dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
        dp[i][1] = 0;
      } else if (s[i - 1] == 'A' and s[i] == 'B') {
        dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
        dp[i][1] = dp[i - 1][1];
      } else if (s[i - 1] == 'B' and s[i] == 'A') {
        dp[i][0] = dp[i - 1][1];
        dp[i][1] = dp[i - 1][0];
      } else {
        dp[i][0] = dp[i - 1][1];
        dp[i][1] = dp[i - 1][1];
      }
    }
  };
  lld ans = 0;
  dp[0][0] = 1;
  dp[0][1] = 0;
  calc();
  if (s[n - 1] == 'A')
    ans += dp[n - 1][0] + dp[n - 1][1];
  else
    ans += dp[n - 1][1];
  dp[0][0] = 0;
  dp[0][1] = 1;
  calc();
  if (s[0] == 'A' and s[n - 1] == 'B')
    ans += dp[n - 1][0];
  else if (s[0] == 'B')
    ans += dp[n - 1][1];
  cout << ans << '\n';
  return 0;
}
