#include <bits/stdc++.h>
using namespace std;
long long dp[105][2];
char str[105];
int n;
long long calc(int x) {
  memset(dp, 0, sizeof(dp));
  dp[0][x] = 1;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'A') {
      dp[i + 1][0] += dp[i][0];
      dp[i + 1][0] += dp[i][1];
      if (str[i + 1] == 'B') dp[i + 1][1] += dp[i][1];
    } else {
      dp[i + 1][0] += dp[i][1];
      if (str[i + 1] == 'A')
        dp[i + 1][1] += dp[i][0];
      else
        dp[i + 1][1] += dp[i][1];
    }
  }
  return dp[n][x];
}
int main() {
  scanf("%s", str);
  n = strlen(str);
  str[n] = str[0];
  printf("%lld\n", calc(0) + calc(1));
  return 0;
}
