# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D&lang=jp
#  Areas on the Cross-Section Diagram : python3
#  2018.11.27 yonezawa


from collections import deque
import heapq
import sys
input = sys.stdin.readline


def main():
    q = deque()
    m = str(input()).strip()
    dq = []
    count = 0
    for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
    print (count)
    if (len(dq) == 0):
        print (0)
        return

    l = []
    dq.sort()
    dq.reverse()
    (a,b) = dq.pop()
    
    score = b - a
    while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

    print (len(l),*l)

if __name__ == '__main__':
    main() from collections import deque import heapq heapq import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    q = deque()
    m = str(input()).strip()
    dq = []
    count = 0
    for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
    print (count)
    if (len(dq) == 0):
        print (0)
        return

    l = []
    dq.sort()
    dq.reverse()
    (a,b) = dq.pop()
    
    score = b - a
    while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

    print (len(l),*l) main q = deque() q deque() deque m = str(input()).strip() m str(input()).strip() (input()).strip (input()) str input() input strip dq = [] dq [] count = 0 count 0 for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
     i range(len(m)) range len(m) len m if (m[i] == "\\" ):
            q.append(i)
            continue
         m[i] == "\\" m[i] m i "\\" q.append(i) q.append q append i continue if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
     m[i] == "/" and len(q) > 0 m[i] == "/" m[i] m i "/" len(q) > 0 len(q) len q 0 j = q.pop() j q.pop() q.pop q pop count += i - j count i - j i j dq.append((j,i)) dq.append dq append (j,i) j i print (count) print count if (len(dq) == 0):
        print (0)
        return

     len(dq) == 0 len(dq) len dq 0 print (0) print 0 return l = [] l [] dq.sort() dq.sort dq sort dq.reverse() dq.reverse dq reverse (a,b) = dq.pop() (a,b) a b dq.pop() dq.pop dq pop score = b - a score b - a b a while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

     len(dq) > 0 len(dq) len dq 0 (i,n) = dq.pop() (i,n) i n dq.pop() dq.pop dq pop if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
     b > i b i score += n - i score n - i n i l.append(score) l.append l append score score = n - i score n - i n i a = i a i b = n b n l.append(score) l.append l append score print (len(l),*l) print len(l) len l *l l if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.readline sys.stdin.readline input def main():
    q = deque()
    m = str(input()).strip()
    dq = []
    count = 0
    for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
    print (count)
    if (len(dq) == 0):
        print (0)
        return

    l = []
    dq.sort()
    dq.reverse()
    (a,b) = dq.pop()
    
    score = b - a
    while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

    print (len(l),*l) def main():
    q = deque()
    m = str(input()).strip()
    dq = []
    count = 0
    for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
    print (count)
    if (len(dq) == 0):
        print (0)
        return

    l = []
    dq.sort()
    dq.reverse()
    (a,b) = dq.pop()
    
    score = b - a
    while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

    print (len(l),*l) main
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D&lang=jp
#  Areas on the Cross-Section Diagram : python3
#  2018.11.27 yonezawa


from collections import deque
import heapq
import sys
input = sys.stdin.readline


def main():
    q = deque()
    m = str(input()).strip()
    dq = []
    count = 0
    for i in range(len(m)):
        if (m[i] == "\\" ):
            q.append(i)
            continue
        if (m[i] == "/" and len(q) > 0):
            j = q.pop()
            count += i - j
            #dq.append((j,i))
            dq.append((j,i))
    print (count)
    if (len(dq) == 0):
        print (0)
        return

    l = []
    dq.sort()
    dq.reverse()
    (a,b) = dq.pop()
    
    score = b - a
    while len(dq) > 0:
        (i,n) = dq.pop()
        if ( b > i ):
            score += n - i
        else:
            l.append(score)
            score = n - i
            a = i
            b = n
    else:
        l.append(score)

    print (len(l),*l)

if __name__ == '__main__':
    main()
