func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 110;   long long dp[N][2], n, val[N], ans;   char s[N];   signed main() {     scanf( %s , s + 1);     n = strlen(s + 1);     for (long long i = 1; i <= n; ++i) val[i] = (s[i] ==  A );     dp[1][val[1]] = 1;     dp[0][0] = 1;     for (long long i = 2; i <= n; ++i) {       if (val[i]) {         dp[i][1] += dp[i - 1][0] + dp[i - 1][1];         if (!val[i - 1] && i != 2) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];       } else         dp[i][0] += dp[i - 1][0];     }     if (val[1])       ans += dp[n][0] + dp[n][1];     else {       ans += dp[n][0];       if (val[2]) {         memset(dp, 0, sizeof dp);         dp[2][0] = 1;         for (long long i = 3; i <= n; ++i) {           if (val[i]) {             dp[i][1] += dp[i - 1][0] + dp[i - 1][1];             if (!val[i - 1] && i != 2) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];           } else             dp[i][0] += dp[i - 1][0];         }         ans += dp[n][0] + dp[n][1];       }     }     memset(dp, 0, sizeof dp);     if (val[1] == 1 && val[n] == 0) {       dp[1][0] = 1;       for (long long i = 2; i < n; ++i) {         if (val[i]) {           dp[i][1] += dp[i - 1][0] + dp[i - 1][1];           if (!val[i - 1]) dp[i][0] += dp[i - 2][0] + dp[i - 2][1];         } else           dp[i][0] += dp[i - 1][0];       }       ans += dp[n - 1][0] + dp[n - 1][1];     }     cout << ans << endl;     return 0;   }   