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

#define BUF_SIZE 20002
#define POOL_SIZE 20002

typedef enum {
  BACK_SLASH,
  POOL,
} Type;

typedef struct {
  Type type;
  int value; // backslash=>index, area=>area
} Item;

int count_pool(Item* stack, int stack_top)
{
  int cnt = 0;
  for(int i = 0; i < stack_top; i++) {
    if(stack[i].type == POOL) {
      cnt++;
    }
  }
  return cnt;
}

void print_stack(Item* stack, int stack_top)
{
  int num_pool = count_pool(stack, stack_top);
  printf("%d ", num_pool);
  int pool_cnt = 0;
  for(int stack_index = 0; stack_index < stack_top; stack_index++) {
    switch(stack[stack_index].type) {
      case POOL:
        pool_cnt++;
        printf("%d", stack[stack_index].value);
        if(pool_cnt == num_pool) {
          putchar('\n');
        } else {
          putchar(' ');
        }
        break;
      case BACK_SLASH:
        break;
      default:
        fputs("Unknown token found in print_stack()\n", stderr);
        exit(1);
    }
  }
}

void print_total_area(Item* stack, int stack_top)
{
  int total_area = 0;
  for(int i = 0; i < stack_top; i++) {
    switch(stack[i].type) {
      case POOL:
        total_area += stack[i].value;
        break;
      case BACK_SLASH:
        break;
      default:
        fprintf(stderr, "Unknown token found: %d\n", stack[i].type);
        exit(1);
    }
  }
  printf("%d\n", total_area);
}

int main()
{
  char buf[BUF_SIZE];
  fgets(buf, sizeof(buf), stdin);
  char* lf_addr = strchr(buf, '\n');
  if(lf_addr) {
    *lf_addr = '\0';
  } else {
    fputs("Error: LF not found\n", stderr);
    exit(1);
  }

  Item stack[POOL_SIZE];
  int stack_top = 0;
  for(size_t i = 0; i < strlen(buf); i++) {
    switch(buf[i]) {
      case '\\':
        stack[stack_top].type = BACK_SLASH;
        stack[stack_top].value = i;
        stack_top++;
        break;
      case '/':;
        int total_area = 0;
        for(int k = stack_top-1; 0 <= k; k--) {
          if(stack[k].type == BACK_SLASH) {
            total_area += i - stack[k].value;
            stack[k].type = POOL;
            stack[k].value = total_area;
            stack_top = k + 1;
            break;
          } else if(stack[k].type == POOL) {
            total_area += stack[k].value;
          } else {
            fputs("Unknown item found\n", stderr);
            exit(1);
          }
        }
        break;
      case '_':
        break;
      default:
        fprintf(stderr, "Unknown token found: %c\n", buf[i]);
        exit(1);
    }
  }

  print_total_area(stack, stack_top);
  print_stack(stack, stack_top);
  return 0;
}

