from collections import deque


def main():
    total = 0
    s1 = deque()
    s2 = deque()
    str = input()
    for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

    for i in range(len(s2)):
        total += s2[i][1]
    print(total)
    if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2))

if __name__ == '__main__':
    main()
 from collections import deque def main():
    total = 0
    s1 = deque()
    s2 = deque()
    str = input()
    for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

    for i in range(len(s2)):
        total += s2[i][1]
    print(total)
    if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2)) main total = 0 total 0 s1 = deque() s1 deque() deque s2 = deque() s2 deque() deque str = input() str input() input for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

     i range(len(str)) range len(str) len str if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

     str[i] == "\\" str[i] str i "\\" s1.append(i) s1.append s1 append i elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

     len(s1) > 0 and str[i] == "/" len(s1) > 0 len(s1) len s1 0 str[i] == "/" str[i] str i "/" old = s1.pop() old s1.pop() s1.pop s1 pop tmp = 0 tmp 0 while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
             len(s2) > 0 and old < s2[-1][0] len(s2) > 0 len(s2) len s2 0 old < s2[-1][0] old s2[-1][0] [-1] s2 -1 0 tmp += s2.pop()[1] tmp s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([old, tmp + i - old]) s2.append s2 append [old, tmp + i - old] old tmp + i - old tmp + i tmp i old for i in range(len(s2)):
        total += s2[i][1]
     i range(len(s2)) range len(s2) len s2 total += s2[i][1] total s2[i][1] [i] s2 i 1 print(total) print total if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2)) s2 print(len(s2), end="") print len(s2) len s2 end="" end "" for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
     i range(len(s2)) range len(s2) len s2 if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
     i == len(s2) - 1 i len(s2) - 1 len(s2) len s2 1 print(" {}".format(s2[i][1])) print " {}".format(s2[i][1]) " {}".format " {}" format s2[i][1] [i] s2 i 1 print(" {}".format(s2[i][1]), end="") print " {}".format(s2[i][1]) " {}".format " {}" format s2[i][1] [i] s2 i 1 end="" end "" print(len(s2)) print len(s2) len s2 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    total = 0
    s1 = deque()
    s2 = deque()
    str = input()
    for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

    for i in range(len(s2)):
        total += s2[i][1]
    print(total)
    if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2)) def main():
    total = 0
    s1 = deque()
    s2 = deque()
    str = input()
    for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

    for i in range(len(s2)):
        total += s2[i][1]
    print(total)
    if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2)) main
from collections import deque


def main():
    total = 0
    s1 = deque()
    s2 = deque()
    str = input()
    for i in range(len(str)):
        if str[i] == "\\":
            s1.append(i)
        elif len(s1) > 0 and str[i] == "/":
            old = s1.pop()
            tmp = 0
            while len(s2) > 0 and old < s2[-1][0]:
                tmp += s2.pop()[1]
            s2.append([old, tmp + i - old])

    for i in range(len(s2)):
        total += s2[i][1]
    print(total)
    if s2:
        print(len(s2), end="")
        for i in range(len(s2)):
            if i == len(s2) - 1:
               print(" {}".format(s2[i][1]))
            else:
               print(" {}".format(s2[i][1]), end="")
    else:
        print(len(s2))

if __name__ == '__main__':
    main()

