#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define STACK_SIZE 20000  /* スタックデータ数の最大値 */

typedef struct stack1 {
    int index;
    char slope;
} Stack1;

typedef struct stack2 {
    int index;
    int subtotal;
} Stack2;

Stack1 stack1[STACK_SIZE];
Stack2 stack2[STACK_SIZE];
Stack2 subtotal[STACK_SIZE];
int top1, top2, subtotal_top;
 
void push1(int _index, char _slope){
    stack1[++top1].index = _index;
    stack1[top1].slope = _slope;
}

void push2(int _index, int _subtotal){
    stack2[++top2].index = _index;
    stack2[top2].subtotal = _subtotal;
}

void push_subtotal(int _index, int _subtotal) {
    subtotal[++subtotal_top].index = _index;
    subtotal[subtotal_top].subtotal = _subtotal;
}

Stack1 pop1(){
    top1--;
    return stack1[top1 + 1];
}

Stack2 pop2(){
    top2--;
    return stack2[top2 + 1];
}

Stack2 pop_subtotal(){
    subtotal_top--;
    return subtotal[subtotal_top + 1];
}

int main(void)
{
    int i, sum, subtotal;
    top1 = -1;
    top2 = -1;
    subtotal_top = -1;
    char input[STACK_SIZE];

    i = 0;
    sum = 0;
    subtotal = 0;

    scanf("%s", input);
    
    while(input[i] != '\0'){
        if (input[i] == '\\'){
            push1(i, input[i]); // stack1にiをpush
        } else if (input[i] == '/') {
            while(top1 >= 0) {
                Stack1 stack1_top = pop1();
                if (stack1_top.slope == '\\') {
                    sum += (i - stack1_top.index);
                    push2(stack1_top.index, i - stack1_top.index);

                    break;
                }
                
            }
        }
        i++;
    }
    
    int j = 0;

    if (top2 >= 0) {
        Stack2 tmp = pop2();
        int min_index = tmp.index;
        subtotal = tmp.subtotal;

        while (top2 >= 0) {
            Stack2 stack2 = pop2();

            if (min_index > stack2.index) {
                push_subtotal(min_index, subtotal);
                subtotal = 0;
                min_index = stack2.index;
                subtotal = stack2.subtotal;
            } else if (min_index < stack2.index) {
                subtotal += stack2.subtotal;
            }
        }
        push_subtotal(min_index, subtotal);
    }
    
    printf("%d\n", sum);
    printf("%d", subtotal_top + 1);
     while (subtotal_top >= 0) {
        if (subtotal_top >= 0) printf(" ");
        Stack2 output_subtotal = pop_subtotal();
        printf("%d", output_subtotal.subtotal);
    }
    printf("\n");

    return 0;
}
