from queue import LifoQueue

MAP = input()

que = LifoQueue()
res = LifoQueue()

for i, m in enumerate(MAP):
    if m=='\\':
        que.put(i)
    elif m=='/':
        if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t)

summaly = 0
lakes = []
while not res.empty():
    v = res.get()
    lakes.append(v[1])
    summaly += v[1]

print(summaly)
print(len(lakes), *(reversed(lakes)))
 from queue import LifoQueue MAP = input() MAP input() input que = LifoQueue() que LifoQueue() LifoQueue res = LifoQueue() res LifoQueue() LifoQueue for i, m in enumerate(MAP):
    if m=='\\':
        que.put(i)
    elif m=='/':
        if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t) i m enumerate(MAP) enumerate MAP if m=='\\':
        que.put(i)
    elif m=='/':
        if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t) m=='\\' m '\\' que.put(i) que.put que put i elif m=='/':
        if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t) m=='/' m '/' if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t) not que.empty() que.empty() que.empty que empty j = que.get(False) j que.get(False) que.get que get False v = i - j v i - j i j t = (j, v) t (j, v) j v while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t) not res.empty() res.empty() res.empty res empty pre = res.get(False) pre res.get(False) res.get res get False if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
             pre[0] > j pre[0] pre 0 j t = (t[0], t[1] + pre[1]) t (t[0], t[1] + pre[1]) t[0] t 0 t[1] + pre[1] t[1] t 1 pre[1] pre 1 res.put(pre) res.put res put pre res.put(t) res.put res put t break res.put(t) res.put res put t summaly = 0 summaly 0 lakes = [] lakes [] while not res.empty():
    v = res.get()
    lakes.append(v[1])
    summaly += v[1] not res.empty() res.empty() res.empty res empty v = res.get() v res.get() res.get res get lakes.append(v[1]) lakes.append lakes append v[1] v 1 summaly += v[1] summaly v[1] v 1 print(summaly) print summaly print(len(lakes), *(reversed(lakes))) print len(lakes) len lakes *(reversed(lakes)) reversed(lakes) reversed lakes t = (j, v) (j, v) t summaly += v[1] v[1] summaly j = que.get(False) que.get(False) j MAP = input() input() MAP que = LifoQueue() LifoQueue() que pre = res.get(False) res.get(False) pre v = i - j i - j v res = LifoQueue() LifoQueue() res lakes = [] [] lakes t = (t[0], t[1] + pre[1]) (t[0], t[1] + pre[1]) t summaly = 0 0 summaly v = res.get() res.get() v
from queue import LifoQueue

MAP = input()

que = LifoQueue()
res = LifoQueue()

for i, m in enumerate(MAP):
    if m=='\\':
        que.put(i)
    elif m=='/':
        if not que.empty():
            j = que.get(False)
            v = i - j
            t = (j, v)
            while not res.empty():
                pre = res.get(False)
                if (pre[0] > j):
                    t = (t[0], t[1] + pre[1])
                else:
                    res.put(pre)
                    res.put(t)
                    break
            else:
                res.put(t)

summaly = 0
lakes = []
while not res.empty():
    v = res.get()
    lakes.append(v[1])
    summaly += v[1]

print(summaly)
print(len(lakes), *(reversed(lakes)))

