from collections import deque
s = input()
g = deque()
p = deque()
for i in range(len(s)):
    if s[i] == "\\":
        g.append(i)
    elif s[i] == "/":
        a = 0
        if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop()
for i in range(len(p)):
    p[i] = p[i][1]
if len(p) > 0:
    print(sum(p))
    print(len(p), end = " ")
    print(" ".join(map(str, p)))
else:
    print(0)
    print(0) from collections import deque s = input() s input() input g = deque() g deque() deque p = deque() p deque() deque for i in range(len(s)):
    if s[i] == "\\":
        g.append(i)
    elif s[i] == "/":
        a = 0
        if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop() i range(len(s)) range len(s) len s if s[i] == "\\":
        g.append(i)
    elif s[i] == "/":
        a = 0
        if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop() s[i] == "\\" s[i] s i "\\" g.append(i) g.append g append i elif s[i] == "/":
        a = 0
        if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop() s[i] == "/" s[i] s i "/" a = 0 a 0 if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop() len(g) > 0 len(g) len g 0 while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
             True if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
             len(p) > 0 and p[-1][0] > g[-1] len(p) > 0 len(p) len p 0 p[-1][0] > g[-1] p[-1][0] [-1] p -1 0 g[-1] g -1 a += p[-1][1] a p[-1][1] [-1] p -1 1 p.pop() p.pop p pop break a += i - g[-1] a i - g[-1] i g[-1] g -1 p.append([g[-1], a]) p.append p append [g[-1], a] g[-1] g -1 a g.pop() g.pop g pop for i in range(len(p)):
    p[i] = p[i][1] i range(len(p)) range len(p) len p p[i] = p[i][1] p[i] p i p[i][1] [i] p i 1 if len(p) > 0:
    print(sum(p))
    print(len(p), end = " ")
    print(" ".join(map(str, p)))
else:
    print(0)
    print(0) len(p) > 0 len(p) len p 0 print(sum(p)) print sum(p) sum p print(len(p), end = " ") print len(p) len p end = " " end " " print(" ".join(map(str, p))) print " ".join(map(str, p)) " ".join " " join map(str, p) map str p print(0) print 0 print(0) print 0 g = deque() deque() g s = input() input() s p = deque() deque() p a += i - g[-1] i - g[-1] a a = 0 0 a a += p[-1][1] p[-1][1] a
from collections import deque
s = input()
g = deque()
p = deque()
for i in range(len(s)):
    if s[i] == "\\":
        g.append(i)
    elif s[i] == "/":
        a = 0
        if len(g) > 0:
            while True:
                if len(p) > 0 and p[-1][0] > g[-1]:
                    a += p[-1][1]
                    p.pop()
                else:
                    break
            a += i - g[-1]
            p.append([g[-1], a])
            g.pop()
for i in range(len(p)):
    p[i] = p[i][1]
if len(p) > 0:
    print(sum(p))
    print(len(p), end = " ")
    print(" ".join(map(str, p)))
else:
    print(0)
    print(0)
