inp = input()


lst = list(inp)
stk = []
stk2 = []

for i in range(len(lst)):
    if lst[i] == '\\':
        stk.append(i)
    if lst[i] == '/' and len(stk)>0:
        idx = stk.pop()
        a = i - idx
        if len(stk2) > 0:
            while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
        stk2.append([idx, a])

s = 0
l = []

for i in stk2:
    l.append((i[1]))
    s += i[1]
print(s)
if(len(stk2) > 0):
    print(len(stk2), end=' ')
    print(*l)
else:
    print("0")
 inp = input() inp input() input lst = list(inp) lst list(inp) list inp stk = [] stk [] stk2 = [] stk2 [] for i in range(len(lst)):
    if lst[i] == '\\':
        stk.append(i)
    if lst[i] == '/' and len(stk)>0:
        idx = stk.pop()
        a = i - idx
        if len(stk2) > 0:
            while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
        stk2.append([idx, a]) i range(len(lst)) range len(lst) len lst if lst[i] == '\\':
        stk.append(i)
     lst[i] == '\\' lst[i] lst i '\\' stk.append(i) stk.append stk append i if lst[i] == '/' and len(stk)>0:
        idx = stk.pop()
        a = i - idx
        if len(stk2) > 0:
            while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
        stk2.append([idx, a]) lst[i] == '/' and len(stk)>0 lst[i] == '/' lst[i] lst i '/' len(stk)>0 len(stk) len stk 0 idx = stk.pop() idx stk.pop() stk.pop stk pop a = i - idx a i - idx i idx if len(stk2) > 0:
            while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
         len(stk2) > 0 len(stk2) len stk2 0 while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
         len(stk2) > 0 len(stk2) len stk2 0 tmp = stk2.pop() tmp stk2.pop() stk2.pop stk2 pop if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
         idx < tmp[0] idx tmp[0] tmp 0 a += tmp[1] a tmp[1] tmp 1 stk2.append(tmp) stk2.append stk2 append tmp break stk2.append([idx, a]) stk2.append stk2 append [idx, a] idx a s = 0 s 0 l = [] l [] for i in stk2:
    l.append((i[1]))
    s += i[1] i stk2 l.append((i[1])) l.append l append i[1] i 1 s += i[1] s i[1] i 1 print(s) print s if(len(stk2) > 0):
    print(len(stk2), end=' ')
    print(*l)
else:
    print("0") len(stk2) > 0 len(stk2) len stk2 0 print(len(stk2), end=' ') print len(stk2) len stk2 end=' ' end ' ' print(*l) print *l l print("0") print "0" stk = [] [] stk a = i - idx i - idx a tmp = stk2.pop() stk2.pop() tmp s = 0 0 s stk2 = [] [] stk2 l = [] [] l inp = input() input() inp idx = stk.pop() stk.pop() idx s += i[1] i[1] s lst = list(inp) list(inp) lst a += tmp[1] tmp[1] a
inp = input()


lst = list(inp)
stk = []
stk2 = []

for i in range(len(lst)):
    if lst[i] == '\\':
        stk.append(i)
    if lst[i] == '/' and len(stk)>0:
        idx = stk.pop()
        a = i - idx
        if len(stk2) > 0:
            while(len(stk2) > 0):
                tmp = stk2.pop()
                if idx < tmp[0]:
                    a += tmp[1]
                else:
                    stk2.append(tmp)
                    break
        stk2.append([idx, a])

s = 0
l = []

for i in stk2:
    l.append((i[1]))
    s += i[1]
print(s)
if(len(stk2) > 0):
    print(len(stk2), end=' ')
    print(*l)
else:
    print("0")

