S = input()
lake_sum = 0
stack1 = []
stack2 = []
for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if stack1 == []:
            continue
        j = stack1.pop()
        area = i - j
        lake_sum += area
        while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
        stack2.append((j, area))
print(lake_sum)
if stack2 == []:
    print(0)
else:
    lakes = []
    lakes.append(str(len(stack2)))
    for lake in stack2:
        lakes.append(str(lake[1]))
    print(' '.join(lakes)) S = input() S input() input lake_sum = 0 lake_sum 0 stack1 = [] stack1 [] stack2 = [] stack2 [] for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if stack1 == []:
            continue
        j = stack1.pop()
        area = i - j
        lake_sum += area
        while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
        stack2.append((j, area)) i range(len(S)) range len(S) len S if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if stack1 == []:
            continue
        j = stack1.pop()
        area = i - j
        lake_sum += area
        while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
        stack2.append((j, area)) S[i] == '\\' S[i] S i '\\' stack1.append(i) stack1.append stack1 append i elif S[i] == '/':
        if stack1 == []:
            continue
        j = stack1.pop()
        area = i - j
        lake_sum += area
        while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
        stack2.append((j, area)) S[i] == '/' S[i] S i '/' if stack1 == []:
            continue
         stack1 == [] stack1 [] continue j = stack1.pop() j stack1.pop() stack1.pop stack1 pop area = i - j area i - j i j lake_sum += area lake_sum area while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
         True if stack2 == []:
                break
             stack2 == [] stack2 [] break k, l = stack2.pop() k stack2.pop() stack2.pop stack2 pop l if k < j:
                stack2.append((k, l))
                break
             k < j k j stack2.append((k, l)) stack2.append stack2 append (k, l) k l break area += l area l stack2.append((j, area)) stack2.append stack2 append (j, area) j area print(lake_sum) print lake_sum if stack2 == []:
    print(0)
else:
    lakes = []
    lakes.append(str(len(stack2)))
    for lake in stack2:
        lakes.append(str(lake[1]))
    print(' '.join(lakes)) stack2 == [] stack2 [] print(0) print 0 lakes = [] lakes [] lakes.append(str(len(stack2))) lakes.append lakes append str(len(stack2)) str len(stack2) len stack2 for lake in stack2:
        lakes.append(str(lake[1]))
     lake stack2 lakes.append(str(lake[1])) lakes.append lakes append str(lake[1]) str lake[1] lake 1 print(' '.join(lakes)) print ' '.join(lakes) ' '.join ' ' join lakes stack1 = [] [] stack1 area = i - j i - j area area += l l area lake_sum = 0 0 lake_sum S = input() input() S k, l = stack2.pop() stack2.pop() k lakes = [] [] lakes stack2 = [] [] stack2 j = stack1.pop() stack1.pop() j lake_sum += area area lake_sum l = stack2.pop() stack2.pop() l
S = input()
lake_sum = 0
stack1 = []
stack2 = []
for i in range(len(S)):
    if S[i] == '\\':
        stack1.append(i)
    elif S[i] == '/':
        if stack1 == []:
            continue
        j = stack1.pop()
        area = i - j
        lake_sum += area
        while True:
            if stack2 == []:
                break
            k, l = stack2.pop()
            if k < j:
                stack2.append((k, l))
                break
            area += l
        stack2.append((j, area))
print(lake_sum)
if stack2 == []:
    print(0)
else:
    lakes = []
    lakes.append(str(len(stack2)))
    for lake in stack2:
        lakes.append(str(lake[1]))
    print(' '.join(lakes))
