#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string s;
    std::cin >> s;
    std::vector<int> sols;
    for(int k=1; k<=s.length(); k++)
    {
        int alicewins = 0;
        int bobwins = 0;
        int alicepts = 0;
        int bobpts = 0;
        for(int i=0; i<s.length(); i++)
        {
            if(s[i] == 'A')
                alicepts++;
            else
                bobpts++;
            if(alicepts == k)
            {
                alicewins++;
                alicepts = 0;
                bobpts = 0;
            }
            else if(bobpts == k)
            {
                bobwins++;
                alicepts = 0;
                bobpts = 0;
            }
        }
        if(alicewins > bobwins)
        {
            sols.push_back(k);
        }
    }
    std::cout << sols.size() << std::endl;
    for(int i=0; i<sols.size(); i++)
    {
        if(i  != 0)
            std::cout << " ";
        std::cout << sols[i];
    }
    std::cout << std::endl;
}
