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

POOL = []
LOC = []
cnt = 0
sum_S = 0

line = input()

for c in line:
    if c == "\\":
        LOC.append(cnt)
    elif c == "/":
        if len(LOC) == 0:
            continue
        tmp_start = LOC.pop()
        tmp_end = cnt
        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
    cnt += 1

lst = [len(POOL)]
for i in range(len(POOL)):
    lst.append(POOL[i].S)
print(sum_S)
print(*lst) 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 POOL = [] POOL [] LOC = [] LOC [] cnt = 0 cnt 0 sum_S = 0 sum_S 0 line = input() line input() input for c in line:
    if c == "\\":
        LOC.append(cnt)
    elif c == "/":
        if len(LOC) == 0:
            continue
        tmp_start = LOC.pop()
        tmp_end = cnt
        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
    cnt += 1 c line if c == "\\":
        LOC.append(cnt)
    elif c == "/":
        if len(LOC) == 0:
            continue
        tmp_start = LOC.pop()
        tmp_end = cnt
        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
     c == "\\" c "\\" LOC.append(cnt) LOC.append LOC append cnt elif c == "/":
        if len(LOC) == 0:
            continue
        tmp_start = LOC.pop()
        tmp_end = cnt
        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))
     c == "/" c "/" if len(LOC) == 0:
            continue
         len(LOC) == 0 len(LOC) len LOC 0 continue tmp_start = LOC.pop() tmp_start LOC.pop() LOC.pop LOC pop tmp_end = cnt tmp_end cnt 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 cnt += 1 cnt 1 lst = [len(POOL)] lst [len(POOL)] len(POOL) len POOL for i in range(len(POOL)):
    lst.append(POOL[i].S) i range(len(POOL)) range len(POOL) len POOL lst.append(POOL[i].S) lst.append lst append POOL[i].S [i] POOL i S print(sum_S) print sum_S print(*lst) print *lst lst POOL = [] [] POOL sum_S += tmp_S tmp_S sum_S line = input() input() line tmp_end = cnt cnt tmp_end 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 tmp_start = LOC.pop() LOC.pop() tmp_start cnt += 1 1 cnt tmp_S = tmp_end - tmp_start tmp_end - tmp_start tmp_S lst = [len(POOL)] [len(POOL)] lst sum_S = 0 0 sum_S LOC = [] [] LOC cnt = 0 0 cnt 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

POOL = []
LOC = []
cnt = 0
sum_S = 0

line = input()

for c in line:
    if c == "\\":
        LOC.append(cnt)
    elif c == "/":
        if len(LOC) == 0:
            continue
        tmp_start = LOC.pop()
        tmp_end = cnt
        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
    cnt += 1

lst = [len(POOL)]
for i in range(len(POOL)):
    lst.append(POOL[i].S)
print(sum_S)
print(*lst)
