s = input()
s1, s2 = [], []

ans = 0
for i in range(len(s)):
    if s[i] == "\\":
        s1.append(i)
    if s[i] == "/" and s1:
        j = s1.pop()
        a = i - j
        ans += a
        while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
        s2.append([j, a])
print(ans)
print(len(s2), *(a for j, a in s2)) s = input() s input() input s1, s2 = [], [] s1 [] s2 [] ans = 0 ans 0 for i in range(len(s)):
    if s[i] == "\\":
        s1.append(i)
    if s[i] == "/" and s1:
        j = s1.pop()
        a = i - j
        ans += a
        while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
        s2.append([j, a]) i range(len(s)) range len(s) len s if s[i] == "\\":
        s1.append(i)
     s[i] == "\\" s[i] s i "\\" s1.append(i) s1.append s1 append i if s[i] == "/" and s1:
        j = s1.pop()
        a = i - j
        ans += a
        while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
        s2.append([j, a]) s[i] == "/" and s1 s[i] == "/" s[i] s i "/" s1 j = s1.pop() j s1.pop() s1.pop s1 pop a = i - j a i - j i j ans += a ans a while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
         s2 and s2[-1][0] > j s2 s2[-1][0] > j s2[-1][0] [-1] s2 -1 0 j a += s2.pop()[1] a s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([j, a]) s2.append s2 append [j, a] j a print(ans) print ans a for j, a in s2 for j, a in s2 j a s2 for j, a in s2 a print(len(s2), *(a for j, a in s2)) print len(s2) len s2 *(a for j, a in s2) (a for j, a in s2) s2 = [], [] [] s2 j = s1.pop() s1.pop() j a = i - j i - j a ans += a a ans a += s2.pop()[1] s2.pop()[1] a s = input() input() s s1, s2 = [], [] [] s1 ans = 0 0 ans
s = input()
s1, s2 = [], []

ans = 0
for i in range(len(s)):
    if s[i] == "\\":
        s1.append(i)
    if s[i] == "/" and s1:
        j = s1.pop()
        a = i - j
        ans += a
        while s2 and s2[-1][0] > j:
            a += s2.pop()[1]
        s2.append([j, a])
print(ans)
print(len(s2), *(a for j, a in s2))