#include <stdio.h>

#define STR 20000


char lake[2*STR][STR]; //湖
int lakes[STR] = {0}; //小さい湖
int sl[STR]; //湖カウント始点
int d = 0, lc = 0, ll = 0; //d:深さ　lc:湖数 ll:湖総量

//小さい湖・総量の算出
void LakeCount(int ic, int i, int left) { //
    int count, s;
    
    //    printf("ic=%d sl[d]=%d d=%d lc=%d left=%d:LakeC\n",ic,sl[d],d,lc,left);
    s = sl[d];
    for(int k = ic ; k <= i; k++ ) {
        count = 0;
	
        for(int a = sl[d] ; a <= left ; a++) {
	  if(lake[k][a] == '\\') {
	    while(lake[k][a] != '/') {
	      count++;
	      a++;
	    }
	  }
	}

	//        printf("count =%d\n",count);
        
        lakes[lc] += count;
        ll += count;
	
        d--;
    }
}

//水深の算出
void DeepCount(int i, int start, int k) {
  int st, ic = i;
  
  //  printf("%d %d %d %d :DeepC\n", i, start, k, lc);
  sl[d] = start;
  for(st = start ; st <= k ; st++) {
    if(lake[ic - 1][st + 1] == '\\') {
      sl[d + 1] = st + 1;
      d++; ic--;
    }
    else if(lake[ic][st + 1] == '/') {
      //        printf("ic=%d st=%d :DeepC1\n",ic,st);
        LakeCount(ic,i,k);
        break;
    }
    
    //    printf("i=%d st=%d :DeepC\n",i,st);
  }
  
  d = 0;
}

//湖の形成と水面算出と出力
int main(void){
  char a;
  int i, j, k, c = 0, n = 0, min = STR, max = 0;

  for(i = 0 ; i < 2*STR ; i++) {
    for(j = 0 ; j < STR ; j++) {
      lake[i][j] = ' ';
    }
  }

  i = STR;
  j = 0;

  //文字列入力
  while((a = getchar()) != EOF) {
      if(a == '/') {
	lake[i][j] = a;
	i++;
      }
      else if(a == '_') {
	lake[i][j] = a;
      }
      else {
	i--;
	lake[i][j] = a;
      }

      if(i > max) {
	max = i;
      }
      if(i < min) {
	min = i;
	}
      j++;
      n++;
  }

  //printf("%c\n",lake[200][9]);

//水面の検知
  for(j = 0 ; j < n ; j++) {
    for(i = max ; i > min ; i--) {
      if(lake[i][j] == '\\') {
	    for(k = j ; k < n ; k++) {
	        if(lake[i][k] == '/') {
		  c++;
	            lc = j;
	            DeepCount(i, j, k);
		    j = k;
	            break;
	        }
	    }
      }
    }
  }
  
  //小湖・湖の総量出力
  printf("%d\n",ll);
  printf("%d ",c);
  for(int i = 0 ; i < n ; i++) {
      if(lakes[i] != 0) {
          printf("%d",lakes[i]);
          if(i != lc -1) {
              printf(" ");
          }
      }
  }
  printf("\n");
  
  /*
  //湖の出力
  printf("%d %d\n",max,min);
    for(i = max ; i > min ; i--) {
      for(j = 0 ; j < n; j++){
	printf("%c",lake[i-1][j]);
      }
      printf("\n");
    }
  */
  
  return 0;
}
