
class Stack:
    def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

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

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

    def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

    def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

    def top_element(self):
        if not self.is_empty():
            return self.A[self.top]


if __name__ == '__main__':
    S1 = Stack(20005)  # for \
    S2 = Stack(10005)  # for ponds
    line = raw_input()
    for i in range(len(line)):
        if line[i] == '\\':
            S1.push(i)
        elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
        else:
            pass

    l = []
    cnt = 0
    while not S2.is_empty():
        x = S2.pop()
        cnt += x[1]
        l.append(x)
    l.reverse()
    print cnt
    print len(l),
    for x in l:
        print x[1],
    print class Stack:
    def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

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

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

    def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

    def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

    def top_element(self):
        if not self.is_empty():
            return self.A[self.top] Stack def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

     __init__ 0 for i in range(n) for i in range(n) i range(n) range n for i in range(n) 0 self.A = [0 for i in range(n)] self.A self A [0 for i in range(n)] self.len = n self.len self len n self.top = 0 self.top self top 0 self self n n 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.len - 1

     is_full return self.top == self.len - 1 self.top == self.len - 1 self.top self top self.len - 1 self.len self len 1 self self def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

     push if not self.is_full():
            self.top += 1
            self.A[self.top] = x

     not self.is_full() self.is_full() self.is_full self is_full self.top += 1 self.top self top 1 self.A[self.top] = x self.A[self.top] self.A self A self.top self top x self self x x def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

     pop if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

     not self.is_empty() self.is_empty() self.is_empty self is_empty x = self.A[self.top] x self.A[self.top] self.A self A self.top self top self.top -= 1 self.top self top 1 return x x self self def top_element(self):
        if not self.is_empty():
            return self.A[self.top] top_element if not self.is_empty():
            return self.A[self.top] not self.is_empty() self.is_empty() self.is_empty self is_empty return self.A[self.top] self.A[self.top] self.A self A self.top self top self self if __name__ == '__main__':
    S1 = Stack(20005)  # for \
    S2 = Stack(10005)  # for ponds
    line = raw_input()
    for i in range(len(line)):
        if line[i] == '\\':
            S1.push(i)
        elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
        else:
            pass

    l = []
    cnt = 0
    while not S2.is_empty():
        x = S2.pop()
        cnt += x[1]
        l.append(x)
    l.reverse()
    print cnt
    print len(l),
    for x in l:
        print x[1],
    print __name__ == '__main__' __name__ '__main__' S1 = Stack(20005) S1 Stack(20005) Stack 20005 S2 = Stack(10005) S2 Stack(10005) Stack 10005 line = raw_input() line raw_input() raw_input for i in range(len(line)):
        if line[i] == '\\':
            S1.push(i)
        elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
        else:
            pass

     i range(len(line)) range len(line) len line if line[i] == '\\':
            S1.push(i)
        elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
        else:
            pass

     line[i] == '\\' line[i] line i '\\' S1.push(i) S1.push S1 push i elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
         line[i] == '/' line[i] line i '/' if S1.is_empty():
                continue
             S1.is_empty() S1.is_empty S1 is_empty continue j = S1.pop() j S1.pop() S1.pop S1 pop cnt = 0 cnt 0 while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
             not S2.is_empty() and S2.top_element()[0] > j not S2.is_empty() S2.is_empty() S2.is_empty S2 is_empty S2.top_element()[0] > j S2.top_element()[0] S2.top_element() S2.top_element S2 top_element 0 j cnt += S2.pop()[1] cnt S2.pop()[1] S2.pop() S2.pop S2 pop 1 S2.push((j, cnt + i - j)) S2.push S2 push (j, cnt + i - j) j cnt + i - j cnt + i cnt i j l = [] l [] cnt = 0 cnt 0 while not S2.is_empty():
        x = S2.pop()
        cnt += x[1]
        l.append(x)
     not S2.is_empty() S2.is_empty() S2.is_empty S2 is_empty x = S2.pop() x S2.pop() S2.pop S2 pop cnt += x[1] cnt x[1] x 1 l.append(x) l.append l append x l.reverse() l.reverse l reverse print print len(l) len l for x in l:
        print x[1],
     x l print x[1] x 1 print cnt += S2.pop()[1] S2.pop()[1] cnt cnt = 0 0 cnt cnt += x[1] x[1] cnt S2 = Stack(10005) Stack(10005) S2 l = [] [] l S1 = Stack(20005) Stack(20005) S1 class Stack:
    def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

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

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

    def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

    def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

    def top_element(self):
        if not self.is_empty():
            return self.A[self.top] class Stack:
    def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

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

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

    def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

    def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

    def top_element(self):
        if not self.is_empty():
            return self.A[self.top] Stack cnt = 0 0 cnt x = S2.pop() S2.pop() x line = raw_input() raw_input() line j = S1.pop() S1.pop() j

class Stack:
    def __init__(self, n):
        self.A = [0 for i in range(n)]
        self.len = n
        self.top = 0

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

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

    def push(self, x):
        if not self.is_full():
            self.top += 1
            self.A[self.top] = x

    def pop(self):
        if not self.is_empty():
            x = self.A[self.top]
            self.top -= 1
            return x

    def top_element(self):
        if not self.is_empty():
            return self.A[self.top]


if __name__ == '__main__':
    S1 = Stack(20005)  # for \
    S2 = Stack(10005)  # for ponds
    line = raw_input()
    for i in range(len(line)):
        if line[i] == '\\':
            S1.push(i)
        elif line[i] == '/':
            if S1.is_empty():
                continue
            j = S1.pop()
            cnt = 0  # total area of ponds that can be merged
            # no more ponds can be merged if S2.top_element()[0] < j, why?
            # because '/' is clearly increasing toward the stack top
            # and '\' is increasing toward the stack top, too
            # if not, there exists a pond that should have been merged
            while not S2.is_empty() and S2.top_element()[0] > j:
                cnt += S2.pop()[1]
            S2.push((j, cnt + i - j))
        else:
            pass

    l = []
    cnt = 0
    while not S2.is_empty():
        x = S2.pop()
        cnt += x[1]
        l.append(x)
    l.reverse()
    print cnt
    print len(l),
    for x in l:
        print x[1],
    print
