import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    stk = []
    pool_stk = []

    ans = 0
    for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
    print(ans)
    print(len(pool_stk), *[i[1] for i in pool_stk])

if __name__ == '__main__':
    resolve()
 import sys, collections sys collections input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = 10**10 INF 10**10 10 10 def I(): return int(input()) I def F(): return float(input()) F def SS(): return input() SS int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x def LI(): return [int(x) for x in input().split()] LI int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in input().split()] LI_ float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() LSS def resolve():
    S = SS()
    stk = []
    pool_stk = []

    ans = 0
    for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
    print(ans)
    print(len(pool_stk), *[i[1] for i in pool_stk]) resolve S = SS() S SS() SS stk = [] stk [] pool_stk = [] pool_stk [] ans = 0 ans 0 for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
     i e enumerate(S) enumerate S if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
     e=='\\' e '\\' stk.append(i) stk.append stk append i elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
     e=='/' e '/' if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
     stk idx_d = stk.pop() idx_d stk.pop() stk.pop stk pop pool_layer = i - idx_d pool_layer i - idx_d i idx_d ans += pool_layer ans pool_layer if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
     pool_stk and idx_d<pool_stk[-1][0] pool_stk idx_d<pool_stk[-1][0] idx_d pool_stk[-1][0] [-1] pool_stk -1 0 merged_pool = 0 merged_pool 0 while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                     pool_stk and idx_d<pool_stk[-1][0] pool_stk idx_d<pool_stk[-1][0] idx_d pool_stk[-1][0] [-1] pool_stk -1 0 pool_tmp = pool_stk.pop() pool_tmp pool_stk.pop() pool_stk.pop pool_stk pop merged_pool += pool_tmp[1] merged_pool pool_tmp[1] pool_tmp 1 pool_stk.append((idx_d, merged_pool+pool_layer)) pool_stk.append pool_stk append (idx_d, merged_pool+pool_layer) idx_d merged_pool+pool_layer merged_pool pool_layer pool_stk.append((idx_d, pool_layer)) pool_stk.append pool_stk append (idx_d, pool_layer) idx_d pool_layer print(ans) print ans i[1] for i in pool_stk for i in pool_stk i pool_stk for i in pool_stk i[1] i 1 print(len(pool_stk), *[i[1] for i in pool_stk]) print len(pool_stk) len pool_stk *[i[1] for i in pool_stk] [i[1] for i in pool_stk] if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve INF = 10**10 10**10 INF def LSS(): return input().split() def LSS(): return input().split() LSS def LI(): return [int(x) for x in input().split()] def LI(): return [int(x) for x in input().split()] LI def LF(): return [float(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] LF input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def SS(): return input() def SS(): return input() SS def F(): return float(input()) def F(): return float(input()) F def I(): return int(input()) def I(): return int(input()) I def LI_(): return [int(x)-1 for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] LI_ def resolve():
    S = SS()
    stk = []
    pool_stk = []

    ans = 0
    for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
    print(ans)
    print(len(pool_stk), *[i[1] for i in pool_stk]) def resolve():
    S = SS()
    stk = []
    pool_stk = []

    ans = 0
    for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
    print(ans)
    print(len(pool_stk), *[i[1] for i in pool_stk]) resolve
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    stk = []
    pool_stk = []

    ans = 0
    for i, e in enumerate(S):
        if e=='\\':
            stk.append(i)
        elif e=='/':
            if stk:
                idx_d = stk.pop()
                pool_layer = i - idx_d
                ans += pool_layer
                if pool_stk and idx_d<pool_stk[-1][0]:
                    merged_pool = 0
                    while pool_stk and idx_d<pool_stk[-1][0]:
                        pool_tmp = pool_stk.pop()
                        merged_pool += pool_tmp[1]
                    pool_stk.append((idx_d, merged_pool+pool_layer))
                else:
                    pool_stk.append((idx_d, pool_layer))
    
    print(ans)
    print(len(pool_stk), *[i[1] for i in pool_stk])

if __name__ == '__main__':
    resolve()

