down = []
puddles = []
ans = 0

for i, s in enumerate(input()):
    if s == '\\':
        down.append(i)
    elif s == '/' and down:
        l = down.pop()
        # 累積和
        a = i - l
        # 高さが上から見ていった時下向きの斜面が今のペアの斜面より右にきている
        # -> 次の池
        while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
        puddles.append((l, a))


print(sum(a for l, a in puddles))
print(len(puddles), *(a for l, a in puddles)) down = [] down [] puddles = [] puddles [] ans = 0 ans 0 for i, s in enumerate(input()):
    if s == '\\':
        down.append(i)
    elif s == '/' and down:
        l = down.pop()
        # 累積和
        a = i - l
        # 高さが上から見ていった時下向きの斜面が今のペアの斜面より右にきている
        # -> 次の池
        while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
        puddles.append((l, a)) i s enumerate(input()) enumerate input() input if s == '\\':
        down.append(i)
    elif s == '/' and down:
        l = down.pop()
        # 累積和
        a = i - l
        # 高さが上から見ていった時下向きの斜面が今のペアの斜面より右にきている
        # -> 次の池
        while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
        puddles.append((l, a)) s == '\\' s '\\' down.append(i) down.append down append i elif s == '/' and down:
        l = down.pop()
        # 累積和
        a = i - l
        # 高さが上から見ていった時下向きの斜面が今のペアの斜面より右にきている
        # -> 次の池
        while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
        puddles.append((l, a)) s == '/' and down s == '/' s '/' down l = down.pop() l down.pop() down.pop down pop a = i - l a i - l i l while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
         puddles and puddles[-1][0] > l puddles puddles[-1][0] > l puddles[-1][0] [-1] puddles -1 0 l a += puddles.pop()[1] a puddles.pop()[1] puddles.pop() puddles.pop puddles pop 1 puddles.append((l, a)) puddles.append puddles append (l, a) l a print(sum(a for l, a in puddles)) print sum(a for l, a in puddles) sum a a for l, a in puddles for l, a in puddles l a puddles for l, a in puddles a print(len(puddles), *(a for l, a in puddles)) print len(puddles) len puddles *(a for l, a in puddles) (a for l, a in puddles) down = [] [] down a = i - l i - l a ans = 0 0 ans l = down.pop() down.pop() l puddles = [] [] puddles a += puddles.pop()[1] puddles.pop()[1] a
down = []
puddles = []
ans = 0

for i, s in enumerate(input()):
    if s == '\\':
        down.append(i)
    elif s == '/' and down:
        l = down.pop()
        # 累積和
        a = i - l
        # 高さが上から見ていった時下向きの斜面が今のペアの斜面より右にきている
        # -> 次の池
        while puddles and puddles[-1][0] > l:
            a += puddles.pop()[1]
        puddles.append((l, a))


print(sum(a for l, a in puddles))
print(len(puddles), *(a for l, a in puddles))
