class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1]


def main():
    s = input()
    s1, s2 = Stack(20000), Stack(20000)
    pond = [0]
    area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

    s3 = Stack(20000)
    while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

    while not s3.is_empty():
        pond.append(s3.pop()[1])

    pond[0] = len(pond) - 1
    print(area)
    print(" ".join([str(i) for i in pond]))


if __name__ == '__main__':
    main()
 class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] Stack def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

     __init__ self.stack = [None] * full_idx self.stack self stack [None] * full_idx [None] None full_idx self.top = 0 self.top self top 0 self.MAX = full_idx self.MAX self MAX full_idx self self full_idx=10 full_idx 10 def is_empty(self):
        return self.top == 0

     is_empty return self.top == 0 self.top == 0 self.top self top 0 self self def is_full(self):
        return self.top >= self.MAX - 1

     is_full return self.top >= self.MAX - 1 self.top >= self.MAX - 1 self.top self top self.MAX - 1 self.MAX self MAX 1 self self def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

     push if self.is_full():
            raise IndexError

         self.is_full() self.is_full self is_full raise IndexError IndexError self.top += 1 self.top self top 1 self.stack[self.top] = x self.stack[self.top] self.stack self stack self.top self top x self self x x def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] pop if self.is_empty():
            raise IndexError

         self.is_empty() self.is_empty self is_empty raise IndexError IndexError self.top -= 1 self.top self top 1 return self.stack[self.top+1] self.stack[self.top+1] self.stack self stack self.top+1 self.top self top 1 self self def main():
    s = input()
    s1, s2 = Stack(20000), Stack(20000)
    pond = [0]
    area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

    s3 = Stack(20000)
    while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

    while not s3.is_empty():
        pond.append(s3.pop()[1])

    pond[0] = len(pond) - 1
    print(area)
    print(" ".join([str(i) for i in pond])) main s = input() s input() input s1, s2 = Stack(20000), Stack(20000) s1 Stack(20000) Stack 20000 s2 Stack(20000) Stack 20000 pond = [0] pond [0] 0 area = 0 area 0 for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

     i range(len(s)) range len(s) len s if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

     s[i] == "\\" s[i] s i "\\" s1.push(i) s1.push s1 push i s2.push([i, 0]) s2.push s2 push [i, 0] i 0 elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

     s[i] == "/" s[i] s i "/" if not s1.is_empty():
                area += i - s1.pop()
             not s1.is_empty() s1.is_empty() s1.is_empty s1 is_empty area += i - s1.pop() area i - s1.pop() i s1.pop() s1.pop s1 pop if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

     not s2.is_empty() s2.is_empty() s2.is_empty s2 is_empty tup = s2.pop() tup s2.pop() s2.pop s2 pop area2 = 0 area2 0 while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                 tup[1] != 0 tup[1] tup 1 0 tup2 = s2.pop() tup2 s2.pop() s2.pop s2 pop tup, tup2 = tup2, tup tup tup2 tup2 tup area2 += tup2[1] area2 tup2[1] tup2 1 tup[1] = i - tup[0] + area2 tup[1] tup 1 i - tup[0] + area2 i - tup[0] i tup[0] tup 0 area2 if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

     s2.is_empty() s2.is_empty s2 is_empty pond.append(tup[1]) pond.append pond append tup[1] tup 1 s2.push(tup) s2.push s2 push tup s3 = Stack(20000) s3 Stack(20000) Stack 20000 while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

     not s2.is_empty() s2.is_empty() s2.is_empty s2 is_empty ss = s2.pop() ss s2.pop() s2.pop s2 pop if ss[1] != 0:
            s3.push(ss)

     ss[1] != 0 ss[1] ss 1 0 s3.push(ss) s3.push s3 push ss while not s3.is_empty():
        pond.append(s3.pop()[1])

     not s3.is_empty() s3.is_empty() s3.is_empty s3 is_empty pond.append(s3.pop()[1]) pond.append pond append s3.pop()[1] s3.pop() s3.pop s3 pop 1 pond[0] = len(pond) - 1 pond[0] pond 0 len(pond) - 1 len(pond) len pond 1 print(area) print area str(i) for i in pond for i in pond i pond for i in pond str(i) str i print(" ".join([str(i) for i in pond])) print " ".join([str(i) for i in pond]) " ".join " " join [str(i) for i in pond] if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    s = input()
    s1, s2 = Stack(20000), Stack(20000)
    pond = [0]
    area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

    s3 = Stack(20000)
    while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

    while not s3.is_empty():
        pond.append(s3.pop()[1])

    pond[0] = len(pond) - 1
    print(area)
    print(" ".join([str(i) for i in pond])) def main():
    s = input()
    s1, s2 = Stack(20000), Stack(20000)
    pond = [0]
    area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

    s3 = Stack(20000)
    while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

    while not s3.is_empty():
        pond.append(s3.pop()[1])

    pond[0] = len(pond) - 1
    print(area)
    print(" ".join([str(i) for i in pond])) main class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] Stack
class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1]


def main():
    s = input()
    s1, s2 = Stack(20000), Stack(20000)
    pond = [0]
    area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            s1.push(i)
            s2.push([i, 0])

        elif s[i] == "/":
            if not s1.is_empty():
                area += i - s1.pop()
            if not s2.is_empty():
                tup = s2.pop()
                area2 = 0

                while tup[1] != 0:
                    tup2 = s2.pop()
                    tup, tup2 = tup2, tup
                    area2 += tup2[1]

                tup[1] = i - tup[0] + area2

                if s2.is_empty():
                    pond.append(tup[1])
                else:
                    s2.push(tup)

    s3 = Stack(20000)
    while not s2.is_empty():
        ss = s2.pop()
        if ss[1] != 0:
            s3.push(ss)

    while not s3.is_empty():
        pond.append(s3.pop()[1])

    pond[0] = len(pond) - 1
    print(area)
    print(" ".join([str(i) for i in pond]))


if __name__ == '__main__':
    main()

