#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<string>

#define MAX_STACKS 20002
#define MAX_DEQUE 100001

struct Data{
  int time;
  char name[16];
};

class List{
  struct list_element{
    int key;
    list_element* back;
    list_element* next;
  };
  list_element list_top = { 0, nullptr, nullptr };
  list_element* list_end = &list_top;
  size_t list_size = 1;
public:
  void list_insert( int x ){
    list_element* l = new list_element;
    l->key = x;
    list_end->next = l;
    l->back = list_end;
    l->next = nullptr;
    list_end = l;
    list_size++;
  }

  void list_delete( int x ){
    list_element* l = list_end;
    while( l != &list_top ){
      if( l->key == x ){
        l->back->next = l->next;
        if( l->next == nullptr ){
          list_end = l->back;
        } else {
          l->next->back = l->back;
        }
        delete l;
        list_size--;
        break;
      }
      l = l->back;
    }
  }

  void list_deleteFirst(){
    if( list_end == nullptr ) return;
    list_element* l = list_end->back;
    delete list_end;
    list_end = l;
    list_end->next = nullptr;
    list_size--;
  }

  void list_deleteLast(){
    if( list_top.next == nullptr ) return;
    list_element* l = list_top.next->next;
    if( l != nullptr ){
      l->back = &list_top;
      delete list_top.next;
      list_top.next = l;
      list_size--;
    } else {
      delete list_top.next;
      list_top.next = nullptr;
      list_end = &list_top;
      list_size--;
    }
  }

  void list_print(){
    for( list_element* l = list_end; l != &list_top; l = l->back ){
      std::cout << l->key;
      if( l->back != &list_top )  std::cout << " ";
    }
    std::cout << std::endl;
  }
};

class Deque{
  Data* addrs[MAX_DEQUE] = { 0 };

  int head = 0;
  int tail = 0;
public:
  void printDeque(){
    int idx = head;
    for( idx; idx >tail; idx-- ){
      std::cout << idx << ": " << addrs[idx]->time << "    " << addrs[idx]->name << std::endl;
    }
  }

  void enque( Data& d ){
    if( head >= MAX_DEQUE-1 ){
      head = 0;
    } else {
      head++;
    }
    addrs[head] = new Data;
    *addrs[head] = d;
    return;
  }

  Data deque(){
    tail++;
    if( tail >= MAX_DEQUE ) tail = 0;
    Data ret = *addrs[tail];
    delete addrs[tail];
    return ret;
  }

  bool isEmpty(){
    return head == tail;
  }

};

class Stack{
  int* addrs[MAX_STACKS];
  unsigned int top = 0;
public:
  int pop(){
    if( top <= 0 ){
      std::cerr << "No stacks" << std::endl;
      exit(0);
    }

    int n = *(addrs[top]);
    delete addrs[top];
    top--;
    return n;
  }
  void push( int num ){
    if( top >= MAX_STACKS - 1 ){
      std::cerr << "Stacks max" << std::endl;
      exit( 0 );
    }
    top++;
    addrs[top] = new int;
    *(addrs[top]) = num;
    return;
  }
  unsigned int size(){
    return top;
  }
};

int main(){
  Stack s;
  std::string field;
  std::cin >> field;
  std::vector< std::pair<int,int> > v1;
  std::vector<int> v2;
  int ret = 0;
  for( int i = 0; i < field.size(); i++ ){
    if( field[i] == '\\' ){
      s.push( i );
    } else if( field[i] == '/' && s.size() ){
      int j = s.pop();
      ret += i-j;
      v1.push_back( std::make_pair( j, i-j ) );
    }
  }


  for( int i = v1.size()-1; i >= 0; i-- ){
    int j = i - 1;
    int total = v1[i].second;
    while( v1[i].first < v1[j].first && j >= 0 ){
      total += v1[j].second;
      j--;
    }
    v2.push_back( total );
    i = j+1;
  }

  std::cout << ret << std::endl;
  std::cout << v2.size();
  if( v2.size() ) std::cout << " ";
    else std::cout << std::endl;
  for( int i = v2.size()-1; i >= 0; i-- ){
    std::cout << v2[i];
    if( i > 0 ) std::cout << " ";
    else std::cout << std::endl;
  }
}



Measured memory_bytes: 3828