#include <stdio.h>
#define N 40000
#define M 20000

int C[N];
int bump[N];
int all[N];
int op;

#if 1
#define gun() getchar_unlocked()
#else
#define gun() getchar()
#endif


int main(){
  int i,j,k,a,b,s,d,e;
  b=M,d=s=0;
  for(a=1;;a++){
    e=gun();
    if(e<=' ')
      break;
    if(e=='\\'){
      if(s>0)
	d+=s,all[op++]=s,s=0;
      C[--b]=a;
    }
    else if(e == '/'){
      if(C[b]>0)
	bump[op]=C[b],s+=a-C[b];   
      else if(s>0)
	d+=s,all[op++]=s,s=0;
      b++;    
    }
  }
  if(s>0)
    d+=s,all[op++]=s;

  printf("%d\n",d);
  k=op;
  i=op-1;
  while(i>0){
    j=i-1;
    while(j>=0&&bump[j]>bump[i]){
      all[i]+=all[j],all[j]=0,j--,k--;
    }
    i=j;
  }
  printf("%d",k);
  for(i=0;i<op;i++)
    if(all[i]>0)
      printf(" %d",all[i]);
  putchar('\n');
  return 0;
}
    

  

