#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100;
enum { A, B };
char s[MAX_N + 4];
long long dp[MAX_N + 1][2][2];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  s[n] = s[0];
  dp[0][A][A] = dp[0][B][B] = 1;
  for (int i = 0; i < n; i++) {
    int s0 = s[i] - 'A', s1 = s[i + 1] - 'A';
    for (int st = 0; st < 2; st++) {
      long long da = dp[i][st][A], db = dp[i][st][B];
      if (da > 0) {
        if (s0 == B && s1 == A)
          dp[i + 1][st][B] += da;
        else if (s0 == A)
          dp[i + 1][st][A] += da;
      }
      if (db > 0) {
        dp[i + 1][st][A] += db;
        if (s1 == B) dp[i + 1][st][B] += db;
      }
    }
  }
  printf("%lld\n", dp[n][A][A] + dp[n][B][B]);
  return 0;
}
