//
//  main.c
//  AOJ Areas on the Cross-Section Diagram
//
//  Created by NEO Trinity on 2019/2/27.
//  Copyright © 2019 NEO Trinity. All rights reserved.
//

#include <stdio.h>
struct stack
{
    int a;
    int b;
};

typedef struct stack Stack;

int  stack1 [20010];
int top1=0;
void  push1 (int t)
{
    top1++;
    stack1[top1]=t;
}
int pop1()
{
    top1--;
    return stack1[top1+1];
}

Stack stack2 [20010];
int top2=0;
void push2 (Stack t)
{
    top2++;
    stack2[top2]=t;
}
Stack pop2()
{
    top2--;
    return  stack2[top2+1];
}


int main()
{
    char ch;
    int j,sum=0;
    Stack t;
    for(int i=0;scanf("%c",&ch)!=EOF;i++)
    {
        if(ch=='\\') push1(i);
        if(ch=='/' && top1>0)
        {
            j=pop1();
            sum+=i-j;
            t.a=i-j;
            t.b=j;
//            printf("%d\n",t.a);
            while(top2>0 && stack2[top2].b>j)
            {
                t.a+=pop2().a;
            }
            push2(t);
        }
        
    }
    printf("%d\n",sum);
    int ans[top2+10];
    printf("%d",top2);
    
    if(top2!=0)printf(" ");
//    printf("%d\n",pop2().a);
//     printf("%d\n",pop2().a);
    int n=top2;
    for(int i=0;i<n;i++)
    {
        ans[i]=pop2().a;
//        printf("hi=%d i=%d\t ",ans[i],i);
    }
    for(int i=n-1;i>-1;i--)
    {
        printf("%d",ans[i]);
        if(i!=0)printf(" ");
    }
    printf("\n");
    return 0;
}
/*
 31
 5 4 2 1 19 5
    /\_/\/\
\  /       \
 \/         \  _/\
             \/
*/

