s = input()
depth_list = [0]*len(s)
max_depth = [0]*len(s)
d = 0
for i, c in enumerate(s):
    if c == "\\":
        d -= 1
    elif c == "/":
        d += 1
    depth_list[i] = d

m_d = d
for i in range(len(s)-1, -1, -1):
    if s[i] == "\\":
        d += 1
    elif s[i] == "/":
        d -= 1
    max_depth[i] = m_d
    m_d = max(m_d, d)

d = 0
m_d = 0
water = 0
puddles = [0]
for i, n in enumerate(depth_list):
    up = min(m_d, max_depth[i])
    if d < up and d != n or d == up and d > n:
        water += 0.5
    if d < n:
        d = n
    water += max(0, up - d)
    d = n
    m_d = max(m_d, d)

    if d == up and sum(puddles) < int(water):
        m_d = d
        puddles.append(int(water - sum(puddles)))
print(int(water))
print(str(len(puddles)-1)+(" "if len(puddles)>1 else "")+" ".join([str(n) for n in puddles[1:]])) s = input() s input() input depth_list = [0]*len(s) depth_list [0]*len(s) [0] 0 len(s) len s max_depth = [0]*len(s) max_depth [0]*len(s) [0] 0 len(s) len s d = 0 d 0 for i, c in enumerate(s):
    if c == "\\":
        d -= 1
    elif c == "/":
        d += 1
    depth_list[i] = d i c enumerate(s) enumerate s if c == "\\":
        d -= 1
    elif c == "/":
        d += 1
     c == "\\" c "\\" d -= 1 d 1 elif c == "/":
        d += 1
     c == "/" c "/" d += 1 d 1 depth_list[i] = d depth_list[i] depth_list i d m_d = d m_d d for i in range(len(s)-1, -1, -1):
    if s[i] == "\\":
        d += 1
    elif s[i] == "/":
        d -= 1
    max_depth[i] = m_d
    m_d = max(m_d, d) i range(len(s)-1, -1, -1) range len(s)-1 len(s) len s 1 -1 -1 if s[i] == "\\":
        d += 1
    elif s[i] == "/":
        d -= 1
     s[i] == "\\" s[i] s i "\\" d += 1 d 1 elif s[i] == "/":
        d -= 1
     s[i] == "/" s[i] s i "/" d -= 1 d 1 max_depth[i] = m_d max_depth[i] max_depth i m_d m_d = max(m_d, d) m_d max(m_d, d) max m_d d d = 0 d 0 m_d = 0 m_d 0 water = 0 water 0 puddles = [0] puddles [0] 0 for i, n in enumerate(depth_list):
    up = min(m_d, max_depth[i])
    if d < up and d != n or d == up and d > n:
        water += 0.5
    if d < n:
        d = n
    water += max(0, up - d)
    d = n
    m_d = max(m_d, d)

    if d == up and sum(puddles) < int(water):
        m_d = d
        puddles.append(int(water - sum(puddles))) i n enumerate(depth_list) enumerate depth_list up = min(m_d, max_depth[i]) up min(m_d, max_depth[i]) min m_d max_depth[i] max_depth i if d < up and d != n or d == up and d > n:
        water += 0.5
     d < up and d != n or d == up and d > n d < up and d != n d < up d up d != n d n d == up and d > n d == up d up d > n d n water += 0.5 water 0.5 if d < n:
        d = n
     d < n d n d = n d n water += max(0, up - d) water max(0, up - d) max 0 up - d up d d = n d n m_d = max(m_d, d) m_d max(m_d, d) max m_d d if d == up and sum(puddles) < int(water):
        m_d = d
        puddles.append(int(water - sum(puddles))) d == up and sum(puddles) < int(water) d == up d up sum(puddles) < int(water) sum(puddles) sum puddles int(water) int water m_d = d m_d d puddles.append(int(water - sum(puddles))) puddles.append puddles append int(water - sum(puddles)) int water - sum(puddles) water sum(puddles) sum puddles print(int(water)) print int(water) int water str(n) for n in puddles[1:] for n in puddles[1:] n puddles[1:] puddles 1: 1 for n in puddles[1:] str(n) str n print(str(len(puddles)-1)+(" "if len(puddles)>1 else "")+" ".join([str(n) for n in puddles[1:]])) print str(len(puddles)-1)+(" "if len(puddles)>1 else "")+" ".join([str(n) for n in puddles[1:]]) str(len(puddles)-1)+(" "if len(puddles)>1 else "") str(len(puddles)-1) str len(puddles)-1 len(puddles) len puddles 1 " "if len(puddles)>1 else "" len(puddles)>1 len(puddles) len puddles 1 " " "" " ".join([str(n) for n in puddles[1:]]) " ".join " " join [str(n) for n in puddles[1:]] d += 1 1 d m_d = max(m_d, d) max(m_d, d) m_d d += 1 1 d d -= 1 1 d s = input() input() s max_depth = [0]*len(s) [0]*len(s) max_depth d = n n d d = n n d water += max(0, up - d) max(0, up - d) water d = 0 0 d water = 0 0 water m_d = d d m_d up = min(m_d, max_depth[i]) min(m_d, max_depth[i]) up water += 0.5 0.5 water m_d = 0 0 m_d depth_list = [0]*len(s) [0]*len(s) depth_list d -= 1 1 d m_d = d d m_d puddles = [0] [0] puddles d = 0 0 d m_d = max(m_d, d) max(m_d, d) m_d
s = input()
depth_list = [0]*len(s)
max_depth = [0]*len(s)
d = 0
for i, c in enumerate(s):
    if c == "\\":
        d -= 1
    elif c == "/":
        d += 1
    depth_list[i] = d

m_d = d
for i in range(len(s)-1, -1, -1):
    if s[i] == "\\":
        d += 1
    elif s[i] == "/":
        d -= 1
    max_depth[i] = m_d
    m_d = max(m_d, d)

d = 0
m_d = 0
water = 0
puddles = [0]
for i, n in enumerate(depth_list):
    up = min(m_d, max_depth[i])
    if d < up and d != n or d == up and d > n:
        water += 0.5
    if d < n:
        d = n
    water += max(0, up - d)
    d = n
    m_d = max(m_d, d)

    if d == up and sum(puddles) < int(water):
        m_d = d
        puddles.append(int(water - sum(puddles)))
print(int(water))
print(str(len(puddles)-1)+(" "if len(puddles)>1 else "")+" ".join([str(n) for n in puddles[1:]]))