using System;
using System.Collections.Generic;

namespace ConsoleApplication3
{


    class Program
    {
       struct peak {
           public     int height;
           public     int position;
       };
       static double water(peak start, peak end, string data)
       {
           double result = 0;
           int revised_start = start.position;
           if (start.height > end.height)
           {
               int hight = start.height;
               for (int i = start.position+1; i < end.position; i++)
               {
                   if (data[i] == '_')
                       continue;
                   hight--;
                   if (hight == end.height)
                   {
                       revised_start = i;
                       break;
                   }
               }
           }
            int depth = 0;
            for (int j = revised_start; j <= end.position; j++)
            {

                if (data[j] == '/')
                {
                    depth--;
                    result += depth+0.5;
                    if (depth == 0)
                        break;
                }
                else if(data[j] == '_')
                {
                    result += depth;
                }else
                {
                    result += depth+0.5;
                    depth++;
                }

            }

           return result;
       }
  

        static void Main(string[] args)
        {
            double result=0;
            int highest=0,count,hight,start=0;
            bool up = false,down=false;
            var output = new List<double>();
            var position = new List<peak>();
            string Data = Console.ReadLine();


            for (
                count = 0; count < Data.Length; count++)
            {

                if (Data[count] == '/')
                {
                    highest++;
                }
                else if (Data[count] == '_')
                {
                    continue;
                }else
                {
                    peak point = new peak();
                    point.height = highest;
                    if (count > 0)
                    {
                        point.position = count;
                    }
                    else
                        point.position = 0;
                    position.Add(point);
                    break;

                }
            }
            hight = highest;
            for (; count < Data.Length; count++)
            {

                if (Data[count] == '/')
                {
                    hight++;
                    if (down == true)
                    {
                        down = false;
                        up = true;
                    }
                    if (count == Data.Length - 1)
                    {
                        for (int i = position.Count - 2; i > start; i -= 2)
                        {
                            if (position[i].height < hight )
                            {
                                position.RemoveAt(i);
                                position.RemoveAt(i);
                            }
                        }
                        peak point = new peak();
                        point.height = hight;
                        point.position = count;
                        position.Add(point);

                    }
                }
                else if (Data[count] == '\\')
                {
                    hight--;
                    if (down == false && up == false)
                    {
                        down = true;
                    }
                    else if (down == false && up == true)
                    {
                        for (int i = position.Count - 2; i > start; i-=2)
                        {
                            if (position[i].height < hight + 1)
                            {
                                position.RemoveAt(i);
                                position.RemoveAt(i);
                            }
                        }
                        down = true;
                        up = false;
                        peak point = new peak();
                        point.height = hight + 1;
                        point.position = count - 1;
                        position.Add(point);
                        point = new peak();
                        point.height = hight + 1;
                        point.position = count;
                        position.Add(point);
                        if (hight + 1 >= highest)
                        {
                            start = position.Count - 1;
                            highest = hight + 1;
                        }

                    }

                }
                else
                {
                    if (count == Data.Length - 1 && up == true)
                    {
                        for (int i = position.Count - 2; i > start; i -= 2)
                        {
                            if (position[i].height < hight )
                            {
                                position.RemoveAt(i);
                                position.RemoveAt(i);
                            }
                        }
                        peak point = new peak();
                        point.height = hight;
                        point.position = count;
                        position.Add(point);

                    }
                }
            }
            double temp;
            var flood = new List<double>();
            for (int j = 0; j < position.Count -1; j+=2)
            {
                temp = water(position[j], position[j + 1], Data);
                result+=temp;
                flood.Add(temp);
            }




            Console.WriteLine("{0}", result);
            if (flood.Count == 0)
                Console.WriteLine("0");
            else
            {
                Console.Write("{0} ", flood.Count);
                Console.WriteLine(string.Join(" ", flood));
            }
        }
    }
}



Measured memory_bytes: 17912