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

typedef struct StkKey {
    int b4;
    int area;
} StkKey;
typedef struct StkDat {
    StkKey key;
    struct StkDat *next;
} StkDat;
typedef struct Stack {
    size_t len;
    StkDat *top;
} Stack;
#define stk_init(s) ((s) ? ((s)->len = 0, (s)->top = NULL) : 0)
#define stk_len(s) ((s) ? (s)->len : 0)
#define stk_top(s) ((s)->top->key)
StkKey stk_pop(Stack *stk_hdr) {
    assert(stk_hdr->len != 0);
    stk_hdr->len--;
    StkKey key = stk_hdr->top->key;
    StkDat *old_head = stk_hdr->top;
    stk_hdr->top = stk_hdr->top->next;
    free(old_head);
    return key;
}
void stk_push(Stack *stk_hdr, const StkKey key) {
    StkDat *new_dat = (StkDat *)malloc(sizeof(StkDat));
    new_dat->key = key;
    new_dat->next = stk_hdr->top;
    stk_hdr->top = new_dat;
    stk_hdr->len++;
}

int main(int argc, char **argv) {
    Stack stk_index;
    stk_init(&stk_index);
    Stack stk_area;
    stk_init(&stk_area);
    char c;
    StkKey key;
    for(int i = 0; ~scanf("%c", &c); ++i) {
        switch(c) {
        case '\\':
            stk_push(&stk_index, (StkKey){i, 0});
            break;
        case '/':
            if(stk_len(&stk_index) == 0) break;
            key = stk_pop(&stk_index);
            while(stk_len(&stk_area) && key.b4 < stk_top(&stk_area).b4) {
                key.area += stk_pop(&stk_area).area;
            }
            stk_push(&stk_area, (StkKey){key.b4, i - key.b4 + key.area});
            break;
        default:
            break;
        }
    }
    int rstack[10000];
    int area = 0;
    int stk_len = (int)stk_len(&stk_area);
    for(size_t i = 0; i < stk_len; ++i) {
        rstack[i] = stk_pop(&stk_area).area;
        area += rstack[i];
    }
    printf("%d\n", area);
    printf("%d", stk_len);
    for(int i = stk_len - 1; i >= 0; --i) {
        printf(i ? " %d" : " %d\n", rstack[i]);
    }
}

