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

typedef struct{
    int s1;
    int area;
}stack2;
typedef struct{
    stack2 *s2;
    int count2;
    int size2;
}STACK2;
void updateS2(STACK2 *S2,int s,int area){
    if(S2->count2==0){
        S2->s2[0].s1=s;
        S2->s2[0].area=area;
        S2->count2++;
        return;
    }
    
    if(S2->count2>=S2->size2){
        while(S2->count2>0&&S2->s2[S2->count2-1].s1>s){
            area=area+S2->s2[S2->count2-1].area;
            S2->s2[S2->count2-1].area=-1;
            S2->count2--;
        }
    }else{
        while(S2->count2>=0&&S2->s2[S2->count2].s1>s){
            area=area+S2->s2[S2->count2].area;
            S2->s2[S2->count2].area=-1;
            S2->count2--;
        }
    }
    
    if(S2->count2>=S2->size2){
        S2->size2++;
        S2->s2=(stack2*)realloc(S2->s2,sizeof(stack2)*S2->size2);
        S2->s2[S2->count2].s1=s;
        S2->s2[S2->count2].area=area;
        S2->count2++;
    }else{
        if(S2->count2<0)S2->count2=0;
        S2->s2[S2->count2].s1=s;
        S2->s2[S2->count2].area=area;
        S2->count2++;
    }
}

int main(void){
    int *stack1;
    stack1=(int*)malloc(sizeof(int));
    stack1[0]=-1;
    int size1=1;
    int count1=0;
    
    STACK2 S2;
    S2.s2=(stack2*)malloc(sizeof(stack2));
    S2.s2[0].s1=-1;
    S2.s2[0].area=-1;
    S2.size2=1;
    S2.count2=0;
    
    int s;
    int area;
    
    int i=0;
    char c;
    c='\0';
    scanf("%c",&c);
    
    while(c!='\0'){
        if(c=='\\'){
            if(size1<=count1){
                size1++;
                stack1=(int*)realloc(stack1,sizeof(int)*size1);
                stack1[count1]=i;
                count1++;
            }else if(size1>count1){
                if(count1<0)count1=0;
                stack1[count1]=i;
                count1++;
            }
        }else if(c=='/'){
            count1--;
            if(count1>=0){  //count1が負のときスタック1は空
                s=stack1[count1];
                area=i-s;
                updateS2(&S2,s,area);
            }
        }
        
        c='\0';
        scanf("%c",&c);
        i++;
    }
    
    int sum=0;
    int pool=0;
    for(i=0;i<S2.size2;i++){
        if(S2.s2[i].area>0){
            sum=sum+S2.s2[i].area;
            pool++;
        }
    }
    printf("%d\n%d",sum,pool);
    for(i=0;i<S2.size2;i++){
        if(S2.s2[i].area>0)printf(" %d",S2.s2[i].area);
    }
    printf("\n");
}

