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

int main(){
  stack<int>s1;
  stack<pair<int,int>>s2;
  int ans=0;
  char c;
  for(int i=0;cin>>c;i++){
    if(c=='\\'){
      s1.push(i);
    }
    else if(c=='/'&&s1.size()>0){
      int j=s1.top();s1.pop();
      int a=i-j;
      ans+=a;
      while(s2.size()>0&&s2.top().first>j){
        a+=s2.top().second;s2.pop();
      }
      s2.push(make_pair(i,a));
    }
  }
  cout <<ans<<endl;
  vector<int>w;
  while(s2.size()){
    w.push_back(s2.top().second);s2.pop();
  }
  cout << w.size();
  reverse(w.begin(),w.end());
  for(int i=0;i<w.size();i++){
    cout << " ";
    cout << w[i];
  }
  cout <<endl;
}
