from collections import deque

data = input()
tmp = deque()
se = list()
ase = list()
lakes = list()

x = 0
#check start - end
for a in data:
  if a == '\\':
    tmp.append(x)
  if a == '/' and len(tmp) > 0 :
    s = tmp.pop()
    se.append([s,x])
  x += 1
se.sort()

# analyse s -e
if len(se) > 0 :
  ase.append(se[0])
  for i in range(1,len(se)) :
    s,e = ase[len(ase)-1]
    if e < se[i][0]:
      ase.append(se[i])

#calc lakes
for a in ase:
  lsize = 0
  deep = 0
  lx = a[0]
  for m in data[a[0]:a[1] + 1] :
    if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
    lx += 1

print(sum(lakes))
print(len(lakes),end="")
for lake in lakes:
  print(" {}".format(lake),end="")
print() from collections import deque data = input() data input() input tmp = deque() tmp deque() deque se = list() se list() list ase = list() ase list() list lakes = list() lakes list() list x = 0 x 0 for a in data:
  if a == '\\':
    tmp.append(x)
  if a == '/' and len(tmp) > 0 :
    s = tmp.pop()
    se.append([s,x])
  x += 1 a data if a == '\\':
    tmp.append(x)
   a == '\\' a '\\' tmp.append(x) tmp.append tmp append x if a == '/' and len(tmp) > 0 :
    s = tmp.pop()
    se.append([s,x])
   a == '/' and len(tmp) > 0 a == '/' a '/' len(tmp) > 0 len(tmp) len tmp 0 s = tmp.pop() s tmp.pop() tmp.pop tmp pop se.append([s,x]) se.append se append [s,x] s x x += 1 x 1 se.sort() se.sort se sort if len(se) > 0 :
  ase.append(se[0])
  for i in range(1,len(se)) :
    s,e = ase[len(ase)-1]
    if e < se[i][0]:
      ase.append(se[i])

#calc lakes len(se) > 0 len(se) len se 0 ase.append(se[0]) ase.append ase append se[0] se 0 for i in range(1,len(se)) :
    s,e = ase[len(ase)-1]
    if e < se[i][0]:
      ase.append(se[i])

#calc lakes i range(1,len(se)) range 1 len(se) len se s,e = ase[len(ase)-1] s ase[len(ase)-1] ase len(ase)-1 len(ase) len ase 1 e if e < se[i][0]:
      ase.append(se[i])

#calc lakes e < se[i][0] e se[i][0] [i] se i 0 ase.append(se[i]) ase.append ase append se[i] se i for a in ase:
  lsize = 0
  deep = 0
  lx = a[0]
  for m in data[a[0]:a[1] + 1] :
    if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
    lx += 1 a ase lsize = 0 lsize 0 deep = 0 deep 0 lx = a[0] lx a[0] a 0 for m in data[a[0]:a[1] + 1] :
    if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
    lx += 1 m data[a[0]:a[1] + 1] data a[0]:a[1] + 1 a[0] a 0 a[1] + 1 a[1] a 1 1 if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
     m == '\\' m '\\' lsize += 1 + deep lsize 1 + deep 1 deep deep += 1 deep 1 elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
     m == '/' m '/' deep -= 1 deep 1 lsize += deep lsize deep if lx == a[1]:
        lakes.append(lsize)
     lx == a[1] lx a[1] a 1 lakes.append(lsize) lakes.append lakes append lsize lsize += deep lsize deep lx += 1 lx 1 print(sum(lakes)) print sum(lakes) sum lakes print(len(lakes),end="") print len(lakes) len lakes end="" end "" for lake in lakes:
  print(" {}".format(lake),end="") lake lakes print(" {}".format(lake),end="") print " {}".format(lake) " {}".format " {}" format lake end="" end "" print() print data = input() input() data deep += 1 1 deep lx += 1 1 lx deep -= 1 1 deep se = list() list() se ase = list() list() ase lsize += deep deep lsize lakes = list() list() lakes tmp = deque() deque() tmp s,e = ase[len(ase)-1] ase[len(ase)-1] s x = 0 0 x s = tmp.pop() tmp.pop() s lsize += deep deep lsize e = ase[len(ase)-1] ase[len(ase)-1] e x += 1 1 x lx = a[0] a[0] lx deep = 0 0 deep lsize = 0 0 lsize lsize += 1 + deep 1 + deep lsize
from collections import deque

data = input()
tmp = deque()
se = list()
ase = list()
lakes = list()

x = 0
#check start - end
for a in data:
  if a == '\\':
    tmp.append(x)
  if a == '/' and len(tmp) > 0 :
    s = tmp.pop()
    se.append([s,x])
  x += 1
se.sort()

# analyse s -e
if len(se) > 0 :
  ase.append(se[0])
  for i in range(1,len(se)) :
    s,e = ase[len(ase)-1]
    if e < se[i][0]:
      ase.append(se[i])

#calc lakes
for a in ase:
  lsize = 0
  deep = 0
  lx = a[0]
  for m in data[a[0]:a[1] + 1] :
    if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
    lx += 1

print(sum(lakes))
print(len(lakes),end="")
for lake in lakes:
  print(" {}".format(lake),end="")
print()
