#  Areas on the Cross-Section Diagram

class depth_Char:
    ch = ""
    depth = 0

    def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

    def __str__(self):

        return f"{self.ch}:{self.depth}"


string = input()

depth = 0
d_list = []
for ch in string:
    if ch == "\\":
        depth -= 1
        d_list.append(depth_Char(ch,depth))

    elif ch == "_":
        d_list.append(depth_Char(ch,depth))

    elif ch == "/":
        d_list.append(depth_Char(ch,depth))
        depth += 1

# print(*d_list)

lake_list = []  #池のリストを作る
bslash_dict = dict()
for i,d_ch in enumerate(d_list):

    if d_ch.ch == "\\":
        bslash_dict[d_ch.depth] = i
    elif d_ch.ch == "/" and d_ch.depth in bslash_dict:
        j = bslash_dict[d_ch.depth]

        is_need_append = True
        # print(f"search:{[j,i]}")
        remove_list = []  # foreachループの中では削除せず、最後にまとめて削除する

        for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
        for rem in remove_list:
            lake_list.remove(rem)

        if is_need_append:
            lake_list.append([j,i])
        

lake_area_list = []
for i,j in lake_list:
    lake = string[i:j+1]
    t_depth = 0
    area = 0
    for ch in lake:
        if ch == "\\":
            t_depth += 1
            area += t_depth
        elif ch == "_":
            area += t_depth
        elif ch == "/":
            t_depth -= 1
            area += t_depth
    
    lake_area_list.append(area)

print(sum(lake_area_list))
print(len(lake_area_list),*lake_area_list)


 class depth_Char:
    ch = ""
    depth = 0

    def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

    def __str__(self):

        return f"{self.ch}:{self.depth}" depth_Char ch = "" ch "" depth = 0 depth 0 def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

     __init__ self.ch = char self.ch self ch char self.depth = depth self.depth self depth depth self self char char depth depth def __str__(self):

        return f"{self.ch}:{self.depth}" __str__ return f"{self.ch}:{self.depth}" f"{self.ch}:{self.depth}" self self string = input() string input() input depth = 0 depth 0 d_list = [] d_list [] for ch in string:
    if ch == "\\":
        depth -= 1
        d_list.append(depth_Char(ch,depth))

    elif ch == "_":
        d_list.append(depth_Char(ch,depth))

    elif ch == "/":
        d_list.append(depth_Char(ch,depth))
        depth += 1

# print(*d_list) ch string if ch == "\\":
        depth -= 1
        d_list.append(depth_Char(ch,depth))

    elif ch == "_":
        d_list.append(depth_Char(ch,depth))

    elif ch == "/":
        d_list.append(depth_Char(ch,depth))
        depth += 1

# print(*d_list) ch == "\\" ch "\\" depth -= 1 depth 1 d_list.append(depth_Char(ch,depth)) d_list.append d_list append depth_Char(ch,depth) depth_Char ch depth elif ch == "_":
        d_list.append(depth_Char(ch,depth))

     ch == "_" ch "_" d_list.append(depth_Char(ch,depth)) d_list.append d_list append depth_Char(ch,depth) depth_Char ch depth elif ch == "/":
        d_list.append(depth_Char(ch,depth))
        depth += 1

# print(*d_list) ch == "/" ch "/" d_list.append(depth_Char(ch,depth)) d_list.append d_list append depth_Char(ch,depth) depth_Char ch depth depth += 1 depth 1 lake_list = [] lake_list [] bslash_dict = dict() bslash_dict dict() dict for i,d_ch in enumerate(d_list):

    if d_ch.ch == "\\":
        bslash_dict[d_ch.depth] = i
    elif d_ch.ch == "/" and d_ch.depth in bslash_dict:
        j = bslash_dict[d_ch.depth]

        is_need_append = True
        # print(f"search:{[j,i]}")
        remove_list = []  # foreachループの中では削除せず、最後にまとめて削除する

        for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
        for rem in remove_list:
            lake_list.remove(rem)

        if is_need_append:
            lake_list.append([j,i])
         i d_ch enumerate(d_list) enumerate d_list if d_ch.ch == "\\":
        bslash_dict[d_ch.depth] = i
    elif d_ch.ch == "/" and d_ch.depth in bslash_dict:
        j = bslash_dict[d_ch.depth]

        is_need_append = True
        # print(f"search:{[j,i]}")
        remove_list = []  # foreachループの中では削除せず、最後にまとめて削除する

        for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
        for rem in remove_list:
            lake_list.remove(rem)

        if is_need_append:
            lake_list.append([j,i])
         d_ch.ch == "\\" d_ch.ch d_ch ch "\\" bslash_dict[d_ch.depth] = i bslash_dict[d_ch.depth] bslash_dict d_ch.depth d_ch depth i elif d_ch.ch == "/" and d_ch.depth in bslash_dict:
        j = bslash_dict[d_ch.depth]

        is_need_append = True
        # print(f"search:{[j,i]}")
        remove_list = []  # foreachループの中では削除せず、最後にまとめて削除する

        for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
        for rem in remove_list:
            lake_list.remove(rem)

        if is_need_append:
            lake_list.append([j,i])
         d_ch.ch == "/" and d_ch.depth in bslash_dict d_ch.ch == "/" d_ch.ch d_ch ch "/" d_ch.depth in bslash_dict d_ch.depth d_ch depth bslash_dict j = bslash_dict[d_ch.depth] j bslash_dict[d_ch.depth] bslash_dict d_ch.depth d_ch depth is_need_append = True is_need_append True remove_list = [] remove_list [] for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
         lake lake_list if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

             is_need_append and lake[0] < j and i < lake[1] is_need_append and lake[0] < j is_need_append lake[0] < j lake[0] lake 0 j i < lake[1] i lake[1] lake 1 is_need_append = False is_need_append False if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
         j < lake[0] and lake[1] < i j < lake[0] j lake[0] lake 0 lake[1] < i lake[1] lake 1 i remove_list.append(lake) remove_list.append remove_list append lake for rem in remove_list:
            lake_list.remove(rem)

         rem remove_list lake_list.remove(rem) lake_list.remove lake_list remove rem if is_need_append:
            lake_list.append([j,i])
         is_need_append lake_list.append([j,i]) lake_list.append lake_list append [j,i] j i lake_area_list = [] lake_area_list [] for i,j in lake_list:
    lake = string[i:j+1]
    t_depth = 0
    area = 0
    for ch in lake:
        if ch == "\\":
            t_depth += 1
            area += t_depth
        elif ch == "_":
            area += t_depth
        elif ch == "/":
            t_depth -= 1
            area += t_depth
    
    lake_area_list.append(area) i j lake_list lake = string[i:j+1] lake string[i:j+1] string i:j+1 i j+1 j 1 t_depth = 0 t_depth 0 area = 0 area 0 for ch in lake:
        if ch == "\\":
            t_depth += 1
            area += t_depth
        elif ch == "_":
            area += t_depth
        elif ch == "/":
            t_depth -= 1
            area += t_depth
    
     ch lake if ch == "\\":
            t_depth += 1
            area += t_depth
        elif ch == "_":
            area += t_depth
        elif ch == "/":
            t_depth -= 1
            area += t_depth
    
     ch == "\\" ch "\\" t_depth += 1 t_depth 1 area += t_depth area t_depth elif ch == "_":
            area += t_depth
         ch == "_" ch "_" area += t_depth area t_depth elif ch == "/":
            t_depth -= 1
            area += t_depth
    
     ch == "/" ch "/" t_depth -= 1 t_depth 1 area += t_depth area t_depth lake_area_list.append(area) lake_area_list.append lake_area_list append area print(sum(lake_area_list)) print sum(lake_area_list) sum lake_area_list print(len(lake_area_list),*lake_area_list) print len(lake_area_list) len lake_area_list *lake_area_list lake_area_list j = bslash_dict[d_ch.depth] bslash_dict[d_ch.depth] j depth = 0 0 depth bslash_dict = dict() dict() bslash_dict remove_list = [] [] remove_list depth += 1 1 depth is_need_append = True True is_need_append t_depth = 0 0 t_depth t_depth -= 1 1 t_depth depth -= 1 1 depth area = 0 0 area is_need_append = False False is_need_append lake = string[i:j+1] string[i:j+1] lake area += t_depth t_depth area lake_area_list = [] [] lake_area_list string = input() input() string d_list = [] [] d_list t_depth += 1 1 t_depth area += t_depth t_depth area area += t_depth t_depth area class depth_Char:
    ch = ""
    depth = 0

    def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

    def __str__(self):

        return f"{self.ch}:{self.depth}" class depth_Char:
    ch = ""
    depth = 0

    def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

    def __str__(self):

        return f"{self.ch}:{self.depth}" depth_Char lake_list = [] [] lake_list
#  Areas on the Cross-Section Diagram

class depth_Char:
    ch = ""
    depth = 0

    def __init__(self,char,depth):
        self.ch = char
        self.depth = depth

    def __str__(self):

        return f"{self.ch}:{self.depth}"


string = input()

depth = 0
d_list = []
for ch in string:
    if ch == "\\":
        depth -= 1
        d_list.append(depth_Char(ch,depth))

    elif ch == "_":
        d_list.append(depth_Char(ch,depth))

    elif ch == "/":
        d_list.append(depth_Char(ch,depth))
        depth += 1

# print(*d_list)

lake_list = []  #池のリストを作る
bslash_dict = dict()
for i,d_ch in enumerate(d_list):

    if d_ch.ch == "\\":
        bslash_dict[d_ch.depth] = i
    elif d_ch.ch == "/" and d_ch.depth in bslash_dict:
        j = bslash_dict[d_ch.depth]

        is_need_append = True
        # print(f"search:{[j,i]}")
        remove_list = []  # foreachループの中では削除せず、最後にまとめて削除する

        for lake in lake_list:
            if is_need_append and lake[0] < j and i < lake[1]:
                is_need_append = False

            if j < lake[0] and lake[1] < i:
                # print(f"remove:{lake}")
                remove_list.append(lake)
        
        for rem in remove_list:
            lake_list.remove(rem)

        if is_need_append:
            lake_list.append([j,i])
        

lake_area_list = []
for i,j in lake_list:
    lake = string[i:j+1]
    t_depth = 0
    area = 0
    for ch in lake:
        if ch == "\\":
            t_depth += 1
            area += t_depth
        elif ch == "_":
            area += t_depth
        elif ch == "/":
            t_depth -= 1
            area += t_depth
    
    lake_area_list.append(area)

print(sum(lake_area_list))
print(len(lake_area_list),*lake_area_list)



