from collections import deque

def scan(que, ps, way):
    Li = 0
    pp = ps
    while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
    return Li

if __name__=='__main__':
    D = input()
    que = deque()
    p = 0
    for c in D:
        que.append(p)
        if   c == "\\" : p += -1
        elif c == "/"  : p +=  1
    que.append(p)
    
    Ll = [] 
    Lr = [] 
    ls = que.popleft()
    if len(que) > 0: rs = que.pop()
    while len(que) > 0:
        while len(que) > 0:
            if que[0] < ls:
                break
            else:
                ls = que.popleft()
        while len(que) > 0:
            if que[-1] < rs:
                break
            else:
                rs = que.pop()
        if len(que) > 0:
            if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
    L = Ll + Lr
    if len(L) > 0:
        print(sum(L))
        print(len(L), *L)
    else:
        print(0)
        print(0) from collections import deque def scan(que, ps, way):
    Li = 0
    pp = ps
    while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
    return Li scan Li = 0 Li 0 pp = ps pp ps while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
     len(que) > 0 len(que) len que 0 if way==0:
            p = que.popleft()
        else:
            p = que.pop()
         way==0 way 0 p = que.popleft() p que.popleft() que.popleft que popleft p = que.pop() p que.pop() que.pop que pop if p < ps:
            Li += ps - p
        else:
            break
         p < ps p ps Li += ps - p Li ps - p ps p break pp = p pp p return Li Li que que ps ps way way if __name__=='__main__':
    D = input()
    que = deque()
    p = 0
    for c in D:
        que.append(p)
        if   c == "\\" : p += -1
        elif c == "/"  : p +=  1
    que.append(p)
    
    Ll = [] 
    Lr = [] 
    ls = que.popleft()
    if len(que) > 0: rs = que.pop()
    while len(que) > 0:
        while len(que) > 0:
            if que[0] < ls:
                break
            else:
                ls = que.popleft()
        while len(que) > 0:
            if que[-1] < rs:
                break
            else:
                rs = que.pop()
        if len(que) > 0:
            if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
    L = Ll + Lr
    if len(L) > 0:
        print(sum(L))
        print(len(L), *L)
    else:
        print(0)
        print(0) __name__=='__main__' __name__ '__main__' D = input() D input() input que = deque() que deque() deque p = 0 p 0 for c in D:
        que.append(p)
        if   c == "\\" : p += -1
        elif c == "/"  : p +=  1
     c D que.append(p) que.append que append p if   c == "\\" : p += -1
        elif c == "/"  : p +=  1
     c == "\\" c "\\" elif c == "/"  : p +=  1
     c == "/" c "/" que.append(p) que.append que append p Ll = [] Ll [] Lr = [] Lr [] ls = que.popleft() ls que.popleft() que.popleft que popleft if len(que) > 0: rs = que.pop()
     len(que) > 0 len(que) len que 0 while len(que) > 0:
        while len(que) > 0:
            if que[0] < ls:
                break
            else:
                ls = que.popleft()
        while len(que) > 0:
            if que[-1] < rs:
                break
            else:
                rs = que.pop()
        if len(que) > 0:
            if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
     len(que) > 0 len(que) len que 0 while len(que) > 0:
            if que[0] < ls:
                break
            else:
                ls = que.popleft()
         len(que) > 0 len(que) len que 0 if que[0] < ls:
                break
            else:
                ls = que.popleft()
         que[0] < ls que[0] que 0 ls break ls = que.popleft() ls que.popleft() que.popleft que popleft while len(que) > 0:
            if que[-1] < rs:
                break
            else:
                rs = que.pop()
         len(que) > 0 len(que) len que 0 if que[-1] < rs:
                break
            else:
                rs = que.pop()
         que[-1] < rs que[-1] que -1 rs break rs = que.pop() rs que.pop() que.pop que pop if len(que) > 0:
            if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
     len(que) > 0 len(que) len que 0 if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
     ls < rs ls rs L = Ll + Lr L Ll + Lr Ll Lr if len(L) > 0:
        print(sum(L))
        print(len(L), *L)
    else:
        print(0)
        print(0) len(L) > 0 len(L) len L 0 print(sum(L)) print sum(L) sum L print(len(L), *L) print len(L) len L *L L print(0) print 0 print(0) print 0 que = deque() deque() que ls = que.popleft() que.popleft() ls ls = que.popleft() que.popleft() ls def scan(que, ps, way):
    Li = 0
    pp = ps
    while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
    return Li def scan(que, ps, way):
    Li = 0
    pp = ps
    while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
    return Li scan Ll = [] [] Ll p = 0 0 p L = Ll + Lr Ll + Lr L rs = que.pop() que.pop() rs D = input() input() D Lr = [] [] Lr
from collections import deque

def scan(que, ps, way):
    Li = 0
    pp = ps
    while len(que) > 0:
        if way==0:
            p = que.popleft()
        else:
            p = que.pop()
        if p < ps:
            Li += ps - p
        else:
            break
        pp = p
    return Li

if __name__=='__main__':
    D = input()
    que = deque()
    p = 0
    for c in D:
        que.append(p)
        if   c == "\\" : p += -1
        elif c == "/"  : p +=  1
    que.append(p)
    
    Ll = [] 
    Lr = [] 
    ls = que.popleft()
    if len(que) > 0: rs = que.pop()
    while len(que) > 0:
        while len(que) > 0:
            if que[0] < ls:
                break
            else:
                ls = que.popleft()
        while len(que) > 0:
            if que[-1] < rs:
                break
            else:
                rs = que.pop()
        if len(que) > 0:
            if ls < rs: Ll.append(scan(que,ls,0))
            else      : Lr.insert(0,scan(que,rs,1))
    L = Ll + Lr
    if len(L) > 0:
        print(sum(L))
        print(len(L), *L)
    else:
        print(0)
        print(0)