from collections import defaultdict




BS, SL = '\\', '/'

diagram = list(input())

flood = defaultdict(int)
total = 0
stack = []

for cur, terrain in enumerate(diagram):
    if terrain == BS:
        stack.append(cur)
    elif terrain == SL and stack:
        first = stack.pop()
        water = cur-first
        total += water
        for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
        flood[(first, cur)] += water

print(total)
print(' '.join(map(str, [len(flood)] + list(flood.values()))))
 from collections import defaultdict BS, SL = '\\', '/' BS '\\' SL '/' diagram = list(input()) diagram list(input()) list input() input flood = defaultdict(int) flood defaultdict(int) defaultdict int total = 0 total 0 stack = [] stack [] for cur, terrain in enumerate(diagram):
    if terrain == BS:
        stack.append(cur)
    elif terrain == SL and stack:
        first = stack.pop()
        water = cur-first
        total += water
        for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
        flood[(first, cur)] += water cur terrain enumerate(diagram) enumerate diagram if terrain == BS:
        stack.append(cur)
    elif terrain == SL and stack:
        first = stack.pop()
        water = cur-first
        total += water
        for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
        flood[(first, cur)] += water terrain == BS terrain BS stack.append(cur) stack.append stack append cur elif terrain == SL and stack:
        first = stack.pop()
        water = cur-first
        total += water
        for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
        flood[(first, cur)] += water terrain == SL and stack terrain == SL terrain SL stack first = stack.pop() first stack.pop() stack.pop stack pop water = cur-first water cur-first cur first total += water total water for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
         (f_first, f_last) f_first f_last list(flood) list flood if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
         first < f_first < cur first < f_first first f_first cur flood[(first, cur)] += flood.pop((f_first, f_last)) flood[(first, cur)] flood (first, cur) first cur flood.pop((f_first, f_last)) flood.pop flood pop (f_first, f_last) f_first f_last flood[(first, cur)] += water flood[(first, cur)] flood (first, cur) first cur water print(total) print total print(' '.join(map(str, [len(flood)] + list(flood.values())))) print ' '.join(map(str, [len(flood)] + list(flood.values()))) ' '.join ' ' join map(str, [len(flood)] + list(flood.values())) map str [len(flood)] + list(flood.values()) [len(flood)] len(flood) len flood list(flood.values()) list flood.values() flood.values flood values total += water water total SL = '\\', '/' '/' SL first = stack.pop() stack.pop() first diagram = list(input()) list(input()) diagram BS, SL = '\\', '/' '\\' BS total = 0 0 total stack = [] [] stack water = cur-first cur-first water flood = defaultdict(int) defaultdict(int) flood
from collections import defaultdict




BS, SL = '\\', '/'

diagram = list(input())

flood = defaultdict(int)
total = 0
stack = []

for cur, terrain in enumerate(diagram):
    if terrain == BS:
        stack.append(cur)
    elif terrain == SL and stack:
        first = stack.pop()
        water = cur-first
        total += water
        for (f_first, f_last) in list(flood):
            if first < f_first < cur:
                flood[(first, cur)] += flood.pop((f_first, f_last))
        flood[(first, cur)] += water

print(total)
print(' '.join(map(str, [len(flood)] + list(flood.values()))))

