from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

class Info:
    def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S


LOC = []
POOL = []

line = input()
loc = 0
sum_S = 0

for ch in line:

    if ch == '\\':

        LOC.append(loc)

    elif ch == '/':

        if len(LOC) == 0:
            continue

        tmp_start = int(LOC.pop())
        tmp_end = loc
        tmp_S = tmp_end-tmp_start;
        sum_S += tmp_S;

        #既に突っ込まれている池の断片が、今回の断片の部分区間になるなら統合する
        while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

        POOL.append(Info(tmp_start,tmp_end,tmp_S))

    else:
        pass

    loc += 1

print("%d"%(sum_S))
print("%d"%(len(POOL)),end = "")

while len(POOL) > 0:
    print(" %d"%(POOL[0].S),end = "") #先頭から
    POOL.pop(0)

print()
 from enum import Enum import sys sys import math math BIG_NUM = 2000000000 BIG_NUM 2000000000 MOD = 1000000007 MOD 1000000007 EPS = 0.000000001 EPS 0.000000001 class Info:
    def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S Info def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S __init__ self.start = arg_start self.start self start arg_start self.end = arg_end self.end self end arg_end self.S = arg_S self.S self S arg_S self self arg_start arg_start arg_end arg_end arg_S arg_S LOC = [] LOC [] POOL = [] POOL [] line = input() line input() input loc = 0 loc 0 sum_S = 0 sum_S 0 for ch in line:

    if ch == '\\':

        LOC.append(loc)

    elif ch == '/':

        if len(LOC) == 0:
            continue

        tmp_start = int(LOC.pop())
        tmp_end = loc
        tmp_S = tmp_end-tmp_start;
        sum_S += tmp_S;

        #既に突っ込まれている池の断片が、今回の断片の部分区間になるなら統合する
        while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

        POOL.append(Info(tmp_start,tmp_end,tmp_S))

    else:
        pass

    loc += 1 ch line if ch == '\\':

        LOC.append(loc)

    elif ch == '/':

        if len(LOC) == 0:
            continue

        tmp_start = int(LOC.pop())
        tmp_end = loc
        tmp_S = tmp_end-tmp_start;
        sum_S += tmp_S;

        #既に突っ込まれている池の断片が、今回の断片の部分区間になるなら統合する
        while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

        POOL.append(Info(tmp_start,tmp_end,tmp_S))

    else:
        pass

     ch == '\\' ch '\\' LOC.append(loc) LOC.append LOC append loc elif ch == '/':

        if len(LOC) == 0:
            continue

        tmp_start = int(LOC.pop())
        tmp_end = loc
        tmp_S = tmp_end-tmp_start;
        sum_S += tmp_S;

        #既に突っ込まれている池の断片が、今回の断片の部分区間になるなら統合する
        while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

        POOL.append(Info(tmp_start,tmp_end,tmp_S))

     ch == '/' ch '/' if len(LOC) == 0:
            continue

         len(LOC) == 0 len(LOC) len LOC 0 continue tmp_start = int(LOC.pop()) tmp_start int(LOC.pop()) int LOC.pop() LOC.pop LOC pop tmp_end = loc tmp_end loc tmp_S = tmp_end-tmp_start tmp_S tmp_end-tmp_start tmp_end tmp_start sum_S += tmp_S sum_S tmp_S while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

         len(POOL) > 0 len(POOL) len POOL 0 if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

         POOL[-1].start > tmp_start and POOL[-1].end < tmp_end POOL[-1].start > tmp_start POOL[-1].start [-1] POOL -1 start tmp_start POOL[-1].end < tmp_end POOL[-1].end [-1] POOL -1 end tmp_end tmp_S += POOL[-1].S tmp_S POOL[-1].S [-1] POOL -1 S POOL.pop() POOL.pop POOL pop break POOL.append(Info(tmp_start,tmp_end,tmp_S)) POOL.append POOL append Info(tmp_start,tmp_end,tmp_S) Info tmp_start tmp_end tmp_S loc += 1 loc 1 print("%d"%(sum_S)) print "%d"%(sum_S) "%d" sum_S print("%d"%(len(POOL)),end = "") print "%d"%(len(POOL)) "%d" len(POOL) len POOL end = "" end "" while len(POOL) > 0:
    print(" %d"%(POOL[0].S),end = "") #先頭から
    POOL.pop(0) len(POOL) > 0 len(POOL) len POOL 0 print(" %d"%(POOL[0].S),end = "") print " %d"%(POOL[0].S) " %d" POOL[0].S [0] POOL 0 S end = "" end "" POOL.pop(0) POOL.pop POOL pop 0 print() print POOL = [] [] POOL tmp_S += POOL[-1].S POOL[-1].S tmp_S class Info:
    def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S class Info:
    def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S Info MOD = 1000000007 1000000007 MOD sum_S = 0 0 sum_S tmp_start = int(LOC.pop()) int(LOC.pop()) tmp_start LOC = [] [] LOC tmp_S = tmp_end-tmp_start tmp_end-tmp_start tmp_S loc = 0 0 loc tmp_end = loc loc tmp_end loc += 1 1 loc sum_S += tmp_S tmp_S sum_S BIG_NUM = 2000000000 2000000000 BIG_NUM EPS = 0.000000001 0.000000001 EPS line = input() input() line
from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

class Info:
    def __init__(self,arg_start,arg_end,arg_S):
        self.start = arg_start
        self.end = arg_end
        self.S = arg_S


LOC = []
POOL = []

line = input()
loc = 0
sum_S = 0

for ch in line:

    if ch == '\\':

        LOC.append(loc)

    elif ch == '/':

        if len(LOC) == 0:
            continue

        tmp_start = int(LOC.pop())
        tmp_end = loc
        tmp_S = tmp_end-tmp_start;
        sum_S += tmp_S;

        #既に突っ込まれている池の断片が、今回の断片の部分区間になるなら統合する
        while len(POOL) > 0:
            if POOL[-1].start > tmp_start and POOL[-1].end < tmp_end:
                tmp_S += POOL[-1].S
                POOL.pop()
            else:
                break

        POOL.append(Info(tmp_start,tmp_end,tmp_S))

    else:
        pass

    loc += 1

print("%d"%(sum_S))
print("%d"%(len(POOL)),end = "")

while len(POOL) > 0:
    print(" %d"%(POOL[0].S),end = "") #先頭から
    POOL.pop(0)

print()

