def main():
    line = input()
    deepen_x = []
    cur_x = 0
    ponds = []      # [(水たまりの最初の位置, 水量)]
    while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

    print(sum([x[1] for x in ponds]))
    if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

    return


main() def main():
    line = input()
    deepen_x = []
    cur_x = 0
    ponds = []      # [(水たまりの最初の位置, 水量)]
    while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

    print(sum([x[1] for x in ponds]))
    if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

    return main line = input() line input() input deepen_x = [] deepen_x [] cur_x = 0 cur_x 0 ponds = [] ponds [] while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

     len(line) > 0 len(line) len line 0 tmp_char = line[0] tmp_char line[0] line 0 if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
         tmp_char == '\\' tmp_char '\\' deepen_x.append(cur_x) deepen_x.append deepen_x append cur_x elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
         tmp_char == '/' and len(deepen_x) != 0 tmp_char == '/' tmp_char '/' len(deepen_x) != 0 len(deepen_x) len deepen_x 0 pre_x = deepen_x.pop() pre_x deepen_x.pop() deepen_x.pop deepen_x pop volume = cur_x - pre_x volume cur_x - pre_x cur_x pre_x if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
         len(ponds) == 0 len(ponds) len ponds 0 ponds.append([pre_x, volume]) ponds.append ponds append [pre_x, volume] pre_x volume if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
         pre_x < ponds[-1][0] pre_x ponds[-1][0] [-1] ponds -1 0 a = list(filter(lambda x: x[0] > pre_x, ponds)) a list(filter(lambda x: x[0] > pre_x, ponds)) list filter(lambda x: x[0] > pre_x, ponds) filter lambda x: x[0] > pre_x x[0] > pre_x x[0] x 0 pre_x x ponds pond = 0 pond 0 for item in a:
                        pond += item[1]
                     item a pond += item[1] pond item[1] item 1 ponds.pop() for x in range(len(a)) for x in range(len(a)) x range(len(a)) range len(a) len a for x in range(len(a)) ponds.pop() ponds.pop ponds pop [ponds.pop() for x in range(len(a))] ponds.append([pre_x, pond + volume]) ponds.append ponds append [pre_x, pond + volume] pre_x pond + volume pond volume ponds.append([pre_x, volume]) ponds.append ponds append [pre_x, volume] pre_x volume cur_x += 1 cur_x 1 line = line[1:] line line[1:] line 1: 1 x[1] for x in ponds for x in ponds x ponds for x in ponds x[1] x 1 print(sum([x[1] for x in ponds])) print sum([x[1] for x in ponds]) sum [x[1] for x in ponds] if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

     len(ponds) == 0 len(ponds) len ponds 0 print('0') print '0' str(x[1]) for x in ponds for x in ponds x ponds for x in ponds str(x[1]) str x[1] x 1 print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds])) print "{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]) "{} ".format(len(ponds)) "{} ".format "{} " format len(ponds) len ponds " ".join([str(x[1]) for x in ponds]) " ".join " " join [str(x[1]) for x in ponds] return main() main def main():
    line = input()
    deepen_x = []
    cur_x = 0
    ponds = []      # [(水たまりの最初の位置, 水量)]
    while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

    print(sum([x[1] for x in ponds]))
    if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

    return def main():
    line = input()
    deepen_x = []
    cur_x = 0
    ponds = []      # [(水たまりの最初の位置, 水量)]
    while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

    print(sum([x[1] for x in ponds]))
    if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

    return main
def main():
    line = input()
    deepen_x = []
    cur_x = 0
    ponds = []      # [(水たまりの最初の位置, 水量)]
    while len(line) > 0:
        #print(cur_x, ponds, deepen_x)
        tmp_char = line[0]
        if tmp_char == '\\':
            deepen_x.append(cur_x)
        elif tmp_char == '/' and len(deepen_x) != 0:
            pre_x = deepen_x.pop()
            volume = cur_x - pre_x
            if len(ponds) == 0:
                ponds.append([pre_x, volume])
            else:
                if pre_x < ponds[-1][0]:
                    # 前の水たまりと結合する
                    a = list(filter(lambda x: x[0] > pre_x, ponds))
                    pond = 0
                    for item in a:
                        pond += item[1]
                    [ponds.pop() for x in range(len(a))]
                    ponds.append([pre_x, pond + volume])
                else:
                    # 新しい水たまりを作成
                    ponds.append([pre_x, volume])
        cur_x += 1
        line = line[1:]

    print(sum([x[1] for x in ponds]))
    if len(ponds) == 0:
        print('0')
    else:
        print("{} ".format(len(ponds)) + " ".join([str(x[1]) for x in ponds]))

    return


main()
