/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Contest 1

Solution to I Could Have Won: https://open.kattis.com/problems/icouldhavewon
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    //Stores the values of k where Alice wins more games
    vector<int> res;

    //Test each value of k from 1 to n
    for(int k = 1; k <= n; k++) {
        //Track Alice's wins and losses and scores of the current game
        int w = 0, l = 0, a = 0, b = 0;

        //Go through the results of each point
        for(int j = 0; j < n; j++) {
            //Update the score of the winning player
            if(s[j] == 'A') a++;
            else b++;

            //Check if someone has won the game
            if(a == k || b == k) {
                if(a == k) w++;
                else l++;
                a = 0, b = 0;
            }
        }
        //If Alice has won more games than Bob, add this k to the results
        if(w > l) res.push_back(k);
    }

    //Display the answers
    cout << res.size() << endl;
    for(int i = 0; i < res.size(); i++) {
        cout << res[i] << ' ';
    }
    cout << endl;
}