#include <stdio.h>
#include <stdlib.h>
#define buf_size 20001

int main( void ){
  char region[ buf_size ];
  scanf("%s", region );

  int k = 0;
  int left_area = 0, right_area = 0;

  int i = 0;
  int left_height = 0, right_height = 0;
  while( region[ i ] != '\0' ){
    switch( region[ i++ ] ){
    case '\\':
      right_height --;
      break;
    case '/':
      right_height ++;
      break;
    }
  }
  int left_weir = 0, right_weir = right_height;

  int *area = ( int * )malloc( i / 2 * sizeof( int ) );
  for( int j = 0; j < i / 2 ; j ++ )
    area[ j ] = -1;

  int left = 0, right = i - 1;
  while( left - 1 <= right && left < i && 0 <= right){
    if( left_weir < right_weir ){
      switch( region[ left ] ){
      case '/':
        left_height ++;
        if( left_weir > left_height ) left_area += left_weir - left_height;
        //printf("Left: area is now [%d]\n", right_area );                                                                    
        if( left_height - left_weir >= 0  && left_area > 0 ){
          //printf("insert head [%d]\n", left_area );                                                                         

          area[ left / 2 ] = left_area;

          left_area = 0;
          k ++;
        }
        break;
      case '_':
        if( left_weir > left_height ) left_area += left_weir - left_height;
        break;
      case '\\':
        if( left_weir < left_height ) left_weir = left_height;
        left_height --;
        if( left_weir > left_height ) left_area += left_weir - left_height;
        //printf("Left: area is now [%d]\n", right_area );                                                                    
        break;
      }
      left ++;
    } else {
    switch( region[ right ] ){
      case '\\':
        right_height ++;
        if( right_weir > right_height ) right_area += right_weir - right_height;
        //printf("Right: area is now [%d]\n", right_area );                                                                   
        if( right_height - right_weir >= 0  && right_area > 0 ){
          //printf("insert last [%d]\n", right_area );                                                                        

          area[ right / 2 ] = right_area;

          right_area = 0;
          k ++;
        }
        break;
      case '_':
        if( right_weir > right_height ) right_area += right_weir - right_height;
        break;
      case '/':
        if( right_weir < right_height ) right_weir = right_height;
        right_height --;
        if( right_weir > right_height ) right_area += right_weir - right_height;
        //printf("Right: area id now [%d]\n", right_area );                                                                   
        break;
      }
      right --;
    }
  }

  int sum = 0, last_j = -1;
  for( int j = 0; j < i / 2; j ++ )
    if( area[ j ] > 0 ){
      sum += area[ j ];
      last_j = j;
    }
  printf("%d\n",sum);
  if( sum > 0 ){
    printf("%d ", k );
    for( int j = 0; j < last_j; j ++ )
      if( area[ j ] > 0 ) printf("%d ", area[ j ] );
    printf("%d\n", area[ last_j ] );
  } else printf("%d\n", k );

  free( area );

  return 0;
}





        
        
        
        
        
        


Measured memory_bytes: 2148