from collections import deque
import sys


def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:]


if __name__ == '__main__':
    S = [c for c in input()]

    waters, S = func(S)

    rev_S = []
    for s in S[::-1]:
        if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

    new_waters, _ = func(rev_S)
    waters += new_waters[::-1]

print(sum(waters))
print(len(waters), *waters)
 from collections import deque import sys sys def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:] func i = 0 i 0 water = 0 water 0 stack = [] stack [] waters = [] waters [] while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

     i < len(S) i len(S) len S for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
         inc s enumerate(S[i:]) enumerate S[i:] S i: i if s == '\\':
                stack.append(s)
                water += len(stack)

             s == '\\' s '\\' stack.append(s) stack.append stack append s water += len(stack) water len(stack) len stack if not stack:
                break

             not stack stack break if s == '/':
                stack.pop()
                water += len(stack)

             s == '/' s '/' stack.pop() stack.pop stack pop water += len(stack) water len(stack) len stack if s == '_':
                water += len(stack)

             s == '_' s '_' water += len(stack) water len(stack) len stack if not stack:
                break
         not stack stack break if water != 0 and not stack:
            waters.append(water)
         water != 0 and not stack water != 0 water 0 not stack stack waters.append(water) waters.append waters append water water = 0 water 0 if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

         inc == len(S[i:]) - 1 inc len(S[i:]) - 1 len(S[i:]) len S[i:] S i: i 1 if not stack:
                i = len(S)
             not stack stack i = len(S) i len(S) len S break i += inc if inc else 1 i inc if inc else 1 inc inc 1 return waters, S[i:] return waters, S[i:] waters S[i:] S i: i S S if __name__ == '__main__':
    S = [c for c in input()]

    waters, S = func(S)

    rev_S = []
    for s in S[::-1]:
        if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

    new_waters, _ = func(rev_S)
    waters += new_waters[::-1] __name__ == '__main__' __name__ '__main__' c for c in input() for c in input() c input() input for c in input() c S = [c for c in input()] S [c for c in input()] waters, S = func(S) waters func(S) func S S rev_S = [] rev_S [] for s in S[::-1]:
        if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

     s S[::-1] S ::-1 -1 if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

     s == '\\' s '\\' rev_S.append('/') rev_S.append rev_S append '/' elif s == '/':
            rev_S.append('\\')
         s == '/' s '/' rev_S.append('\\') rev_S.append rev_S append '\\' rev_S.append('_') rev_S.append rev_S append '_' new_waters, _ = func(rev_S) new_waters func(rev_S) func rev_S _ waters += new_waters[::-1] waters new_waters[::-1] new_waters ::-1 -1 print(sum(waters)) print sum(waters) sum waters print(len(waters), *waters) print len(waters) len waters *waters waters def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:] def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:] func waters += new_waters[::-1] new_waters[::-1] waters waters, S = func(S) func(S) waters _ = func(rev_S) func(rev_S) _ S = func(S) func(S) S S = [c for c in input()] [c for c in input()] S new_waters, _ = func(rev_S) func(rev_S) new_waters rev_S = [] [] rev_S
from collections import deque
import sys


def func(S):
    i = 0
    water = 0
    stack = []
    waters = []
    while i < len(S):
        for inc, s in enumerate(S[i:]):
            if s == '\\':
                stack.append(s)
                water += len(stack)

            if not stack:
                break

            if s == '/':
                stack.pop()
                water += len(stack)

            if s == '_':
                water += len(stack)

            if not stack:
                break
        if water != 0 and not stack:
            waters.append(water)
        water = 0

        if inc == len(S[i:]) - 1:
            if not stack:
                i = len(S)
            break

        i += inc if inc else 1

    return waters, S[i:]


if __name__ == '__main__':
    S = [c for c in input()]

    waters, S = func(S)

    rev_S = []
    for s in S[::-1]:
        if s == '\\':
            rev_S.append('/')
        elif s == '/':
            rev_S.append('\\')
        else:
            rev_S.append('_')

    new_waters, _ = func(rev_S)
    waters += new_waters[::-1]

print(sum(waters))
print(len(waters), *waters)

