#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void push1(int *a,int x);
int pop(int *a);
int isEmpty();
int top1;
struct stack2{
  int index;
  int area;
};
int ppcnt;
void push2(struct stack2 *a, int x1,int x2);
int top2;
int main()
{
  int n,r,i=0,k=0,all=0,st1[20001],c,ind,sub;
  struct stack2 st2[10001];
  char sente[20001];
  top1=0;
  top2=0;
  st2[0].index=-1;
  scanf("%s",sente);
  for(ind=0; ;ind++){
    if(sente[ind]=='\0')break;
    if(sente[ind-1]=='/' && sente[ind]!='/')ppcnt=sub;
    if(sente[ind]=='\\')push1(st1,ind);
    else if(sente[ind]=='/'){
      sub=pop(st1);
      if(sub!=-1)push2(st2,ind,sub);
    }
  }
  for(r=1;r<=top2;r++){
    all+=st2[r].area;
  }
  printf("%d\n",all);
  if(top2==0)printf("%d",top2);
  else {printf("%d ",top2);
    for(r=1;r<=top2;r++){
      printf("%d",st2[r].area);
      if(r!=top2)printf(" ");
    }
  }
  printf("\n");
  return 0;
}
void push1(int *a, int x){
  top1=top1+1;
  a[top1]=x;
  //printf("stack1  %d\n",a[top1]);
}
void push2(struct stack2 *a, int x1,int x2){
  int i,k=0;;
  if((a[top2].index<x2)){
    top2=top2+1;
    a[top2].index=x2;
    a[top2].area=x1-x2;
    //printf("index %d ",a[top2].index);
    //printf("area %d,top(up) %d\n",a[top2].area,top2);
  }else{
    a[top2].area+=(x1-x2);
    k = top2;
    for(i=top2-1;i>=1;i--){
      if(a[i].index > x2){
	a[top2].area += a[i].area;
	k = i;
      }
    }
    a[k].index = a[top2].index;
    a[k].area = a[top2].area;
    top2 = k;
    //printf("index %d ",a[top2].index);
    //printf("area %d, top(stay) %d\n",a[top2].area,top2);
  }
}
int pop(int *a){
  if(isEmpty()==1){
    return -1;
  }else{
    top1=top1-1;
    //printf("pop %d ",a[top1+1]);
    return a[top1+1];
  }
}
int isEmpty(){
  if(top1==0){
    return 1;
  }else{
    return 0;
  }
}


