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

class Peak
{
public:
    int point;
    int height;
};

class Valley
{
public:
    int point;
    int height;
    int startPoint;
    int endPoint;
    int startHeight;
    int endHeight;
    int square;

    bool ignoreFlag;
};

void getPeakAndValley(std::string input, std::vector<Peak> &peaks, std::vector<Valley> &valleys)
{
    int point  = 0;
    int height = 0;
    int lastPoint = input.length() - 1;

    bool isSetting = false;
    bool isRising  = true;

    Peak   tempPeak;
    Valley tempValley;
    for (auto it = input.begin(); it != input.end(); ++it)
    {
        if (*it == '\\')
        {
            if (isRising)
            {
                tempPeak.height = height;
                tempPeak.point  = point;
                peaks.push_back(tempPeak);
                isRising = false;
            }

            height--;
            isSetting = true;
        }
        else if (*it == '/')
        {
            if (isSetting)
            {
                tempValley.height = height;
                tempValley.point  = point;
                valleys.push_back(tempValley);
                isSetting = false;
            }

            height++;
            isRising = true;
        }

        if (point == lastPoint && isRising)
        {
            tempPeak.height = height;
            tempPeak.point  = point + 1;
            peaks.push_back(tempPeak);
        }

        point++;
    }
}

void filterValley(std::vector<Peak> &peaks, std::vector<Valley> &valleys)
{
    for (int v = 0; v < valleys.size(); v++)
    {
        valleys[v].ignoreFlag  = false;

        valleys[v].startHeight = valleys[v].height;
        for (int p = peaks.size() - 1; p >= 0; p--)
        {
            if (peaks[p].point > valleys[v].point) continue;

            if (peaks[p].height > valleys[v].startHeight)
            {
                valleys[v].startHeight = peaks[p].height;
                valleys[v].startPoint  = peaks[p].point;
            }
        }

        valleys[v].endHeight   = valleys[v].height;
        for (int p = 0; p < peaks.size(); p++)
        {
            if (peaks[p].point < valleys[v].point) continue;

            if (peaks[p].height > valleys[v].endHeight)
            {
                valleys[v].endHeight = peaks[p].height;
                valleys[v].endPoint  = peaks[p].point;
            }
        }
    }

    for (int v1 = 0; v1 < valleys.size(); v1++)
    {
        if (valleys[v1].ignoreFlag) continue;
        for (int v2 = v1 + 1; v2 < valleys.size(); v2++)
        {
            if (valleys[v1].startPoint == valleys[v2].startPoint && valleys[v1].endPoint == valleys[v2].endPoint)
            {
                valleys[v2].ignoreFlag = true;
            }
            else if(valleys[v1].startPoint == valleys[v2].startPoint)
            {
                valleys[v2].startPoint  = valleys[v1].endPoint;
                valleys[v2].startHeight = valleys[v1].endHeight;
            }
            else if(valleys[v1].endPoint == valleys[v2].endPoint)
            {
                valleys[v1].endPoint  = valleys[v2].startPoint;
                valleys[v1].endHeight = valleys[v2].startHeight;
            }
        }
    }
}

#define DEBUG_OUTPUT 0
void calcPoolSquare(std::string input, std::vector<Valley> &valleys, int &poolNum, int &totalSquare)
{
    int poolLevel;
    int height;
    int squareBase;
    int poolSquare;

    for (int i = 0; i < valleys.size(); i++)
    {
        if (valleys[i].ignoreFlag) continue;

#if DEBUG_OUTPUT == 1
        std::cout << valleys[i].startPoint << " : " << valleys[i].startHeight << " >>>> "  << valleys[i].endPoint << " : " << valleys[i].endHeight << std::endl;
#endif
        poolLevel  = valleys[i].startHeight < valleys[i].endHeight ? valleys[i].startHeight : valleys[i].endHeight;
        squareBase = 0;
        poolSquare = 0;
        height = valleys[i].startHeight;

        for (int j = valleys[i].startPoint; j <= valleys[i].endPoint; j++)
        {
            if (input[j] == '\\') height--;

            if (height >= poolLevel)
            {
#if DEBUG_OUTPUT == 1
                std::cout << input[j] << std::endl;
#endif
                if (j < valleys[i].point)
                {
                    if (input[j] == '/') height++;
                    continue;
                }
                else break;
            }

            if (input[j] == '\\')
            {
                poolSquare += 1 + squareBase;
                squareBase += 2;
            }
            else if (input[j] == '/')
            {
                squareBase -= 2;
                poolSquare += 1 + squareBase;
            }
            else
            {
                poolSquare += squareBase;
            }

            if (input[j] == '/') height++;

#if DEBUG_OUTPUT == 1
            std::cout << input[j] << " >> " << poolSquare << std::endl;
#endif
        }
        valleys[i].square = poolSquare / 2;
        totalSquare += poolSquare / 2;
        poolNum++;
    }
}

int main()
{
    std::string input;
    std::cin >> input;

    std::vector<Peak>   peaks;
    std::vector<Valley> valleys;
    getPeakAndValley(input, peaks, valleys);

    filterValley(peaks, valleys);
    
    int poolNum = 0;
    int totalSquare = 0;
    calcPoolSquare(input, valleys, poolNum, totalSquare);

    std::cout << totalSquare << std::endl;
    std::cout << poolNum;
    for (int i = 0; i < valleys.size(); i++)
    {
        if (valleys[i].ignoreFlag == false)
        {
            std::cout << " " << valleys[i].square;
        }
    }
    std::cout << std::endl;
}


Measured memory_bytes: 3360