from collections import deque

S = input()

bs_idx = deque()
areas = []
for idx, s in enumerate(S):
    if s == "\\":
        bs_idx.append(idx)
    if s == "/":
        if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx])

areas.sort()

if not areas:
    print(0)
    print(0)
else:
    ans = []
    i = 0
    while True:
        if i == len(areas):
            break
        area = areas[i][1]
        tmp = areas[i][0] + area
        while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

    print(sum(ans))
    print(len(ans), " ".join(map(str, ans)))
 from collections import deque S = input() S input() input bs_idx = deque() bs_idx deque() deque areas = [] areas [] for idx, s in enumerate(S):
    if s == "\\":
        bs_idx.append(idx)
    if s == "/":
        if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx]) idx s enumerate(S) enumerate S if s == "\\":
        bs_idx.append(idx)
     s == "\\" s "\\" bs_idx.append(idx) bs_idx.append bs_idx append idx if s == "/":
        if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx]) s == "/" s "/" if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx]) bs_idx left_idx = bs_idx.pop() left_idx bs_idx.pop() bs_idx.pop bs_idx pop areas.append([left_idx, idx - left_idx]) areas.append areas append [left_idx, idx - left_idx] left_idx idx - left_idx idx left_idx areas.sort() areas.sort areas sort if not areas:
    print(0)
    print(0)
else:
    ans = []
    i = 0
    while True:
        if i == len(areas):
            break
        area = areas[i][1]
        tmp = areas[i][0] + area
        while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

    print(sum(ans))
    print(len(ans), " ".join(map(str, ans))) not areas areas print(0) print 0 print(0) print 0 ans = [] ans [] i = 0 i 0 while True:
        if i == len(areas):
            break
        area = areas[i][1]
        tmp = areas[i][0] + area
        while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

     True if i == len(areas):
            break
         i == len(areas) i len(areas) len areas break area = areas[i][1] area areas[i][1] [i] areas i 1 tmp = areas[i][0] + area tmp areas[i][0] + area areas[i][0] [i] areas i 0 area while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

     True i += 1 i 1 if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

     i != len(areas) and areas[i][0] < tmp i != len(areas) i len(areas) len areas areas[i][0] < tmp areas[i][0] [i] areas i 0 tmp area += areas[i][1] area areas[i][1] [i] areas i 1 ans.append(area) ans.append ans append area break print(sum(ans)) print sum(ans) sum ans print(len(ans), " ".join(map(str, ans))) print len(ans) len ans " ".join(map(str, ans)) " ".join " " join map(str, ans) map str ans bs_idx = deque() deque() bs_idx tmp = areas[i][0] + area areas[i][0] + area tmp i += 1 1 i ans = [] [] ans i = 0 0 i left_idx = bs_idx.pop() bs_idx.pop() left_idx areas = [] [] areas S = input() input() S area += areas[i][1] areas[i][1] area area = areas[i][1] areas[i][1] area
from collections import deque

S = input()

bs_idx = deque()
areas = []
for idx, s in enumerate(S):
    if s == "\\":
        bs_idx.append(idx)
    if s == "/":
        if bs_idx:
            left_idx = bs_idx.pop()
            areas.append([left_idx, idx - left_idx])

areas.sort()

if not areas:
    print(0)
    print(0)
else:
    ans = []
    i = 0
    while True:
        if i == len(areas):
            break
        area = areas[i][1]
        tmp = areas[i][0] + area
        while True:
            i += 1
            if i != len(areas) and areas[i][0] < tmp:
                area += areas[i][1]
            else:
                ans.append(area)
                break

    print(sum(ans))
    print(len(ans), " ".join(map(str, ans)))

