def calcAreas(sections):
    areas = []

    for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

    return areas

def toArea(section):
    a = 0
    b, _ = section[0]

    for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

    return int(a)

def toDelta(p):
    if '/' == p:
        return -1
    if '\\' == p:
        return 1
    return 0

def toPaths(path):
    h = 0
    ph = 0
    paths = []

    for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

    return paths

def update(sections):
    [(lf, ll)] = sections.pop()

    n = None

    for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

    if n == None:
        sections.append([(lf, ll)])
        return False

    lst = [(lf, ll)]
    for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

    sections.append(lst)
    return True

def main():
    paths = toPaths(input())

    prev = -1
    sections = []

    prev_update = True

    for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

    areas = calcAreas(sections)
    l = len(areas)

    print(sum(areas))
    print(l, end='')
    if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
    print()

if __name__ == '__main__':
    main()
 def calcAreas(sections):
    areas = []

    for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

    return areas calcAreas areas = [] areas [] for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

     s sections if len(s) <= 1:
            continue;

         len(s) <= 1 len(s) len s 1 continue areas.append(toArea(s)) areas.append areas append toArea(s) toArea s return areas areas sections sections def toArea(section):
    a = 0
    b, _ = section[0]

    for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

    return int(a) toArea a = 0 a 0 b, _ = section[0] b section[0] section 0 _ for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

     s e section a += (max(s, e) - b) - (0.5 if s != e else 0) a (max(s, e) - b) - (0.5 if s != e else 0) max(s, e) - b max(s, e) max s e b 0.5 if s != e else 0 s != e s e 0.5 0 return int(a) int(a) int a section section def toDelta(p):
    if '/' == p:
        return -1
    if '\\' == p:
        return 1
    return 0 toDelta if '/' == p:
        return -1
     '/' == p '/' p return -1 -1 if '\\' == p:
        return 1
     '\\' == p '\\' p return 1 1 return 0 0 p p def toPaths(path):
    h = 0
    ph = 0
    paths = []

    for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

    return paths toPaths h = 0 h 0 ph = 0 ph 0 paths = [] paths [] for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

     p path h += toDelta(p) h toDelta(p) toDelta p paths.append((ph,h)) paths.append paths append (ph,h) ph h ph = h ph h return paths paths path path def update(sections):
    [(lf, ll)] = sections.pop()

    n = None

    for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

    if n == None:
        sections.append([(lf, ll)])
        return False

    lst = [(lf, ll)]
    for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

    sections.append(lst)
    return True update [(lf, ll)] = sections.pop() [(lf, ll)] (lf, ll) lf ll sections.pop() sections.pop sections pop n = None n None for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

     i range(len(sections)-1, -1, -1) range len(sections)-1 len(sections) len sections 1 -1 -1 if sections[i][0][0] == ll:
            n = i
            break

     sections[i][0][0] == ll sections[i][0][0] [0] [i] sections i 0 0 ll n = i n i break if n == None:
        sections.append([(lf, ll)])
        return False

     n == None n None sections.append([(lf, ll)]) sections.append sections append [(lf, ll)] (lf, ll) lf ll return False False lst = [(lf, ll)] lst [(lf, ll)] (lf, ll) lf ll for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

     i range(len(sections)-1, n-1, -1) range len(sections)-1 len(sections) len sections 1 n-1 n 1 -1 s = sections.pop() s sections.pop() sections.pop sections pop lst = s + lst lst s + lst s lst sections.append(lst) sections.append sections append lst return True True sections sections def main():
    paths = toPaths(input())

    prev = -1
    sections = []

    prev_update = True

    for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

    areas = calcAreas(sections)
    l = len(areas)

    print(sum(areas))
    print(l, end='')
    if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
    print() main paths = toPaths(input()) paths toPaths(input()) toPaths input() input prev = -1 prev -1 sections = [] sections [] prev_update = True prev_update True for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

     f l paths sections.append([(f, l)]) sections.append sections append [(f, l)] (f, l) f l if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

         l < prev l prev if prev_update:
                prev_update = update(sections)
         prev_update prev_update = update(sections) prev_update update(sections) update sections prev_update = True prev_update True prev = l prev l areas = calcAreas(sections) areas calcAreas(sections) calcAreas sections l = len(areas) l len(areas) len areas print(sum(areas)) print sum(areas) sum areas print(l, end='') print l end='' end '' if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
     l > 0 l 0 str(x) for x in areas for x in areas x areas for x in areas str(x) str x print(' {}'.format(' '.join([str(x) for x in areas])), end='') print ' {}'.format(' '.join([str(x) for x in areas])) ' {}'.format ' {}' format ' '.join([str(x) for x in areas]) ' '.join ' ' join [str(x) for x in areas] end='' end '' print() print if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def update(sections):
    [(lf, ll)] = sections.pop()

    n = None

    for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

    if n == None:
        sections.append([(lf, ll)])
        return False

    lst = [(lf, ll)]
    for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

    sections.append(lst)
    return True def update(sections):
    [(lf, ll)] = sections.pop()

    n = None

    for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

    if n == None:
        sections.append([(lf, ll)])
        return False

    lst = [(lf, ll)]
    for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

    sections.append(lst)
    return True update def toDelta(p):
    if '/' == p:
        return -1
    if '\\' == p:
        return 1
    return 0 def toDelta(p):
    if '/' == p:
        return -1
    if '\\' == p:
        return 1
    return 0 toDelta def toArea(section):
    a = 0
    b, _ = section[0]

    for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

    return int(a) def toArea(section):
    a = 0
    b, _ = section[0]

    for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

    return int(a) toArea def calcAreas(sections):
    areas = []

    for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

    return areas def calcAreas(sections):
    areas = []

    for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

    return areas calcAreas def toPaths(path):
    h = 0
    ph = 0
    paths = []

    for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

    return paths def toPaths(path):
    h = 0
    ph = 0
    paths = []

    for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

    return paths toPaths def main():
    paths = toPaths(input())

    prev = -1
    sections = []

    prev_update = True

    for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

    areas = calcAreas(sections)
    l = len(areas)

    print(sum(areas))
    print(l, end='')
    if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
    print() def main():
    paths = toPaths(input())

    prev = -1
    sections = []

    prev_update = True

    for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

    areas = calcAreas(sections)
    l = len(areas)

    print(sum(areas))
    print(l, end='')
    if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
    print() main
def calcAreas(sections):
    areas = []

    for s in sections:
        if len(s) <= 1:
            continue;

        areas.append(toArea(s))

    return areas

def toArea(section):
    a = 0
    b, _ = section[0]

    for s, e in section:
        a += (max(s, e) - b) - (0.5 if s != e else 0)

    return int(a)

def toDelta(p):
    if '/' == p:
        return -1
    if '\\' == p:
        return 1
    return 0

def toPaths(path):
    h = 0
    ph = 0
    paths = []

    for p in path:
        h += toDelta(p)
        paths.append((ph,h))
        ph = h

    return paths

def update(sections):
    [(lf, ll)] = sections.pop()

    n = None

    for i in range(len(sections)-1, -1, -1):
        if sections[i][0][0] == ll:
            n = i
            break

    if n == None:
        sections.append([(lf, ll)])
        return False

    lst = [(lf, ll)]
    for i in range(len(sections)-1, n-1, -1):
        s = sections.pop()
        lst = s + lst

    sections.append(lst)
    return True

def main():
    paths = toPaths(input())

    prev = -1
    sections = []

    prev_update = True

    for f, l in paths:
        sections.append([(f, l)])
        if l < prev:
            if prev_update:
                prev_update = update(sections)
        else:
            prev_update = True

        prev = l

    areas = calcAreas(sections)
    l = len(areas)

    print(sum(areas))
    print(l, end='')
    if l > 0:
        print(' {}'.format(' '.join([str(x) for x in areas])), end='')
    print()

if __name__ == '__main__':
    main()

