using System;
using System.Collections.Generic;

namespace ALDS1_3_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var stackArea = new Stack<Area>();
            var stackAreaSum = new Stack<AreaSum>();
            var values = Console.ReadLine();
            for(int i = 0; i < values.Length; i++)
            {
                if (values[i] == '\\')
                {
                    stackArea.Push(new Area(values[i], i));
                }
                else
                {
                    if(values[i] == '/' && stackArea.Count > 0)
                    {
                        Area area = stackArea.Pop();
                        
                        if(stackAreaSum.Count == 0)
                        {
                            stackAreaSum.Push(new AreaSum(i - area.pos, area.pos));
                        }
                        else
                        {
                            int sum = i-area.pos;
                            while(true)
                            {
                                if(stackAreaSum.Count == 0)
                                {
                                    break;
                                }
                                AreaSum areaSum = stackAreaSum.Pop();
                                if(areaSum.pos > area.pos)
                                {
                                    sum += areaSum.sum;
                                }
                                else
                                {
                                    stackAreaSum.Push(areaSum);
                                    break;
                                }
                            }
                            stackAreaSum.Push(new AreaSum(sum, area.pos));
                        }
                    }
                }
            }
            int ansSum = 0;
            string ansString = "";
            
            foreach (var area in stackAreaSum)
            {
                ansString = area.sum.ToString() + " " + ansString;
                ansSum += area.sum;
            }
            var array = stackAreaSum.ToArray();
            Console.WriteLine(ansSum);
            Console.Write(stackAreaSum.Count);
            if (stackAreaSum.Count != 0)
            {
                Console.Write(" ");
                for (int i = array.Length - 1; i >= 0; i--)
                {
                    Console.Write(array[i].sum);
                    if (i == 0)
                        Console.WriteLine();
                    else
                        Console.Write(" ");
                }
            }
            else
            {
                Console.WriteLine();
            }
        }
        public class Area
        {
            public char c { get; set; }
            public int pos { get; set; }
            public Area(char c, int pos)
            {
                this.c = c;
                this.pos = pos;
            }
        }
        public class AreaSum
        {
            public int sum { get; set; }
            public int pos { get; set; }
            public AreaSum(int sum,int pos)
            {
                this.sum = sum;
                this.pos = pos;
            }
        }


    }
}



Measured memory_bytes: 28372