# -*- coding: utf-8 -*-
# ALDS1_3_D_Areas on the Cross-Section Diagram

from collections import deque

def make_h_list(slope):
    """
    入力データから高さのリストを作る
    """
    h_list =deque([0])
    for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
    return h_list

def trim_edge(h_list, left=True):
    """
    水溜りの境界を探す
    """
    if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
            
def make_w_list(h_list):
    """
    水たまりのリストを作る
    """
    w_list = []
    water = []
    h_list = trim_edge(h_list)
    while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
    return w_list
                
def calc_area(water):
    """
    面積計算
    """
    h = water[0]
    s = 0
    for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
    return abs(int(s))


in_data = str(input())

h_list = make_h_list(in_data)
h_list = trim_edge(h_list, left=False)

if type(h_list) != None:
    w_list = make_w_list(h_list)
    a_list = [calc_area(water) for water in w_list]
else:
    a_list = []

print(sum(a_list))
print(len(a_list), *a_list) from collections import deque def make_h_list(slope):
    """
    入力データから高さのリストを作る
    """
    h_list =deque([0])
    for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
    return h_list make_h_list """
    入力データから高さのリストを作る
    """ h_list =deque([0]) h_list deque([0]) deque [0] 0 for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
     s slope d = 0 d 0 if s == "\\":
            d = -1
        elif s == "/":
            d = 1
         s == "\\" s "\\" d = -1 d -1 elif s == "/":
            d = 1
         s == "/" s "/" d = 1 d 1 h_list.append(h_list[-1] + d) h_list.append h_list append h_list[-1] + d h_list[-1] h_list -1 d return h_list h_list slope slope def trim_edge(h_list, left=True):
    """
    水溜りの境界を探す
    """
    if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             trim_edge """
    水溜りの境界を探す
    """ if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             left while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
     h_list h = h_list.popleft() h h_list.popleft() h_list.popleft h_list popleft if h not in h_list:
                continue
             h not in h_list h h_list continue if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
     h_list[0] - h < 0 h_list[0] - h h_list[0] h_list 0 h 0 h_list.appendleft(h) h_list.appendleft h_list appendleft h return h_list h_list while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             h_list h = h_list.pop() h h_list.pop() h_list.pop h_list pop if h not in h_list:
                continue
             h not in h_list h h_list continue if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             h_list[-1] - h < 0 h_list[-1] - h h_list[-1] h_list -1 h 0 h_list.append(h) h_list.append h_list append h return h_list h_list h_list h_list left=True left True def make_w_list(h_list):
    """
    水たまりのリストを作る
    """
    w_list = []
    water = []
    h_list = trim_edge(h_list)
    while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
    return w_list
                 make_w_list """
    水たまりのリストを作る
    """ w_list = [] w_list [] water = [] water [] h_list = trim_edge(h_list) h_list trim_edge(h_list) trim_edge h_list while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
     h_list h = h_list.popleft() h h_list.popleft() h_list.popleft h_list popleft if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
     not water water water.append(h) water.append water append h elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
         water[0] == h water[0] water 0 h water.append(h) water.append water append h w_list.append(water) w_list.append w_list append water water = [] water [] h_list.appendleft(h) h_list.appendleft h_list appendleft h h_list = trim_edge(h_list) h_list trim_edge(h_list) trim_edge h_list water.append(h) water.append water append h if water[0] < water[-1]:
                water.pop(0)
     water[0] < water[-1] water[0] water 0 water[-1] water -1 water.pop(0) water.pop water pop 0 return w_list w_list h_list h_list def calc_area(water):
    """
    面積計算
    """
    h = water[0]
    s = 0
    for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
    return abs(int(s)) calc_area """
    面積計算
    """ h = water[0] h water[0] water 0 s = 0 s 0 for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
     i range(len(water) - 1) range len(water) - 1 len(water) len water 1 s += (water[i+1] - h) + (water[i+1] - water[i]) / 2 s (water[i+1] - h) + (water[i+1] - water[i]) / 2 water[i+1] - h water[i+1] water i+1 i 1 h (water[i+1] - water[i]) / 2 water[i+1] - water[i] water[i+1] water i+1 i 1 water[i] water i 2 return abs(int(s)) abs(int(s)) abs int(s) int s water water in_data = str(input()) in_data str(input()) str input() input h_list = make_h_list(in_data) h_list make_h_list(in_data) make_h_list in_data h_list = trim_edge(h_list, left=False) h_list trim_edge(h_list, left=False) trim_edge h_list left=False left False if type(h_list) != None:
    w_list = make_w_list(h_list)
    a_list = [calc_area(water) for water in w_list]
else:
    a_list = [] type(h_list) != None type(h_list) type h_list None w_list = make_w_list(h_list) w_list make_w_list(h_list) make_w_list h_list calc_area(water) for water in w_list for water in w_list water w_list for water in w_list calc_area(water) calc_area water a_list = [calc_area(water) for water in w_list] a_list [calc_area(water) for water in w_list] a_list = [] a_list [] print(sum(a_list)) print sum(a_list) sum a_list print(len(a_list), *a_list) print len(a_list) len a_list *a_list a_list def make_h_list(slope):
    """
    入力データから高さのリストを作る
    """
    h_list =deque([0])
    for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
    return h_list def make_h_list(slope):
    """
    入力データから高さのリストを作る
    """
    h_list =deque([0])
    for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
    return h_list make_h_list h_list = make_h_list(in_data) make_h_list(in_data) h_list def make_w_list(h_list):
    """
    水たまりのリストを作る
    """
    w_list = []
    water = []
    h_list = trim_edge(h_list)
    while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
    return w_list
                 def make_w_list(h_list):
    """
    水たまりのリストを作る
    """
    w_list = []
    water = []
    h_list = trim_edge(h_list)
    while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
    return w_list
                 make_w_list h_list = trim_edge(h_list, left=False) trim_edge(h_list, left=False) h_list def trim_edge(h_list, left=True):
    """
    水溜りの境界を探す
    """
    if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             def trim_edge(h_list, left=True):
    """
    水溜りの境界を探す
    """
    if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
             trim_edge in_data = str(input()) str(input()) in_data def calc_area(water):
    """
    面積計算
    """
    h = water[0]
    s = 0
    for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
    return abs(int(s)) def calc_area(water):
    """
    面積計算
    """
    h = water[0]
    s = 0
    for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
    return abs(int(s)) calc_area a_list = [] [] a_list w_list = make_w_list(h_list) make_w_list(h_list) w_list a_list = [calc_area(water) for water in w_list] [calc_area(water) for water in w_list] a_list
# -*- coding: utf-8 -*-
# ALDS1_3_D_Areas on the Cross-Section Diagram

from collections import deque

def make_h_list(slope):
    """
    入力データから高さのリストを作る
    """
    h_list =deque([0])
    for s in slope:
        d = 0
        if s == "\\":
            d = -1
        elif s == "/":
            d = 1
        h_list.append(h_list[-1] + d)
    return h_list

def trim_edge(h_list, left=True):
    """
    水溜りの境界を探す
    """
    if left:
        while h_list:
            h = h_list.popleft()
            if h not in h_list:
                continue
            if h_list[0] - h < 0:
                h_list.appendleft(h)
                return h_list
    else:
        while h_list:
            h = h_list.pop()
            if h not in h_list:
                continue
            if h_list[-1] - h < 0:
                h_list.append(h)
                return h_list
            
def make_w_list(h_list):
    """
    水たまりのリストを作る
    """
    w_list = []
    water = []
    h_list = trim_edge(h_list)
    while h_list:
        h = h_list.popleft()
        if not water:
            water.append(h)
        elif water[0] == h:
            water.append(h)
            w_list.append(water)
            water = []
            h_list.appendleft(h)
            h_list = trim_edge(h_list)
        else:
            water.append(h)
            if water[0] < water[-1]:
                water.pop(0)
    return w_list
                
def calc_area(water):
    """
    面積計算
    """
    h = water[0]
    s = 0
    for i in range(len(water) - 1):
        s += (water[i+1] - h) + (water[i+1] - water[i]) / 2
    return abs(int(s))


in_data = str(input())

h_list = make_h_list(in_data)
h_list = trim_edge(h_list, left=False)

if type(h_list) != None:
    w_list = make_w_list(h_list)
    a_list = [calc_area(water) for water in w_list]
else:
    a_list = []

print(sum(a_list))
print(len(a_list), *a_list)
