#include <bits/stdc++.h>
using namespace std;

void createSections();
void calcFlood();
void printOut();
bool getIsCompleteOfLastFlood();

class Section {
 public:
  int left_height;
  int right_height;
  char type;
};

class Flood {
 public:
  int start_index;
  int start_left_height;
  int end_index;
  int end_right_height;
  bool is_complete;

  Flood() { is_complete = false; }
  int calcArea(Section* sections) {
    int water_surface = getWaterSurface();
    int area = 0;
    for (int i = start_index; i < end_index; i++) {
      if (sections[i].right_height > water_surface) continue;
      area += water_surface - sections[i].right_height;
    }
    return area;
  }

  int getWaterSurface() { return min(start_left_height, end_right_height); }
};

list<Flood*> floods;
Section sections[20000];
int section_num;

int main() {
  createSections();
  calcFlood();
  printOut();
  return 0;
}

void createSections() {
  section_num = 0;
  int height = 0;
  while (true) {
    char c = getchar();
    if (c == '\n') {
      break;
    }
    char section = c;
    sections[section_num].left_height = height;
    if (section == '/') {
      height++;
    } else if (section == '\\') {
      height--;
    }
    sections[section_num].right_height = height;
    sections[section_num].type = section;
    section_num++;
  }
}

void calcFlood() {
  bool is_end_added = true;
  for (int i = 0; i < section_num; i++) {
    if (sections[i].type == '\\') {
      if (getIsCompleteOfLastFlood()) {
        Flood* f = new Flood();
        f->start_index = i;
        f->start_left_height = sections[i].right_height + 1;
        floods.push_back(f);
      }
    } else if (sections[i].type == '/') {
      if (floods.size() == 0) continue;
      floods.back()->is_complete = true;
      floods.back()->end_index = i;
      floods.back()->end_right_height = sections[i].right_height;
      if (sections[i].right_height > floods.back()->getWaterSurface()) {
        int left_edge_index = floods.back()->start_index;
        int left_edge_height = floods.back()->start_left_height;
        for (int j = floods.back()->start_index; j >= 0; j--) {
          if (sections[j].left_height > left_edge_height) {
            left_edge_index = j;
            left_edge_height = sections[j].left_height;
          }
          if (left_edge_height == floods.back()->end_right_height) break;
        }
        if (left_edge_index == floods.back()->start_index) continue;
        Flood* last_flood = floods.back();
        floods.pop_back();

        last_flood->start_index = left_edge_index;
        last_flood->start_left_height = left_edge_height;

        while (floods.size() != 0) {
          if (floods.back()->end_index > left_edge_index) {
            floods.pop_back();
            continue;
          }
          if (floods.back()->start_index < left_edge_index) break;
        }
        floods.push_back(last_flood);
      }
    }
  }
  if (!getIsCompleteOfLastFlood()) floods.pop_back();
}

void printOut() {
  int areas[floods.size()];
  int index = 0;
  int total_area = 0;
  for (auto it = floods.begin(); it != floods.end(); ++it) {
    areas[index] = (*it)->calcArea(sections);
    total_area += areas[index];
    index++;
  }
  printf("%d\n", total_area);
  printf("%d", floods.size());
  for (int i = 0; i < floods.size(); i++) {
    printf(" %d", areas[i]);
  }
  printf("\n");
}

bool getIsCompleteOfLastFlood() {
  if (floods.size() == 0) return true;
  return floods.back()->is_complete;
}


Measured memory_bytes: 3612