f = list(input())
s = []

for i, v in enumerate(f):
    if v == '\\':
        s.append([v, i])
    elif v == '/' and len(s) > 0:
        n = s.pop()
        if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i)


a = [v[1] for v in s if v[0] == '.']
print(sum(a))
a.insert(0, len(a))
print(" ".join([str(v) for v in a]))
 f = list(input()) f list(input()) list input() input s = [] s [] for i, v in enumerate(f):
    if v == '\\':
        s.append([v, i])
    elif v == '/' and len(s) > 0:
        n = s.pop()
        if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i) i v enumerate(f) enumerate f if v == '\\':
        s.append([v, i])
    elif v == '/' and len(s) > 0:
        n = s.pop()
        if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i) v == '\\' v '\\' s.append([v, i]) s.append s append [v, i] v i elif v == '/' and len(s) > 0:
        n = s.pop()
        if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i) v == '/' and len(s) > 0 v == '/' v '/' len(s) > 0 len(s) len s 0 n = s.pop() n s.pop() s.pop s pop if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i) n[0] == '\\' n[0] n 0 '\\' t = i-n[1] t i-n[1] i n[1] n 1 s.append(['.', t]) s.append s append ['.', t] '.' t elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

         len(s) > 0 len(s) len s 0 j = len(s)-1 j len(s)-1 len(s) len s 1 n1 = n[1] n1 n[1] n 1 while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
             j >= 0 and s[j][0] == '.' j >= 0 j 0 s[j][0] == '.' s[j][0] [j] s j 0 '.' n1 += s[j][1] n1 s[j][1] [j] s j 1 j -= 1 j 1 if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

         j >= 0 j 0 m = s[j] m s[j] s j n1 += i-m[1] n1 i-m[1] i m[1] m 1 s = s[:j] s s[:j] s :j j s.append(['.', n1]) s.append s append ['.', n1] '.' n1 s.append(n) s.append s append n s.append(n) s.append s append n v[1] for v in s if v[0] == '.' for v in s if v[0] == '.' v s v[0] == '.' v[0] v 0 '.' if v[0] == '.' v[1] v 1 a = [v[1] for v in s if v[0] == '.'] a [v[1] for v in s if v[0] == '.'] print(sum(a)) print sum(a) sum a a.insert(0, len(a)) a.insert a insert 0 len(a) len a str(v) for v in a for v in a v a for v in a str(v) str v print(" ".join([str(v) for v in a])) print " ".join([str(v) for v in a]) " ".join " " join [str(v) for v in a] f = list(input()) list(input()) f j = len(s)-1 len(s)-1 j t = i-n[1] i-n[1] t a = [v[1] for v in s if v[0] == '.'] [v[1] for v in s if v[0] == '.'] a m = s[j] s[j] m s = s[:j] s[:j] s n = s.pop() s.pop() n n1 = n[1] n[1] n1 n1 += s[j][1] s[j][1] n1 s = [] [] s n1 += i-m[1] i-m[1] n1 j -= 1 1 j
f = list(input())
s = []

for i, v in enumerate(f):
    if v == '\\':
        s.append([v, i])
    elif v == '/' and len(s) > 0:
        n = s.pop()
        if n[0] == '\\':
            t = i-n[1]
            s.append(['.', t])
        elif len(s) > 0:
            j = len(s)-1
            n1 = n[1]
            while j >= 0 and s[j][0] == '.':
                #print(n1, s[j][1])
                n1 += s[j][1]
                j -= 1
            if j >= 0:
                m = s[j]
                # print(m)
                n1 += i-m[1]
                s = s[:j]
                s.append(['.', n1])
            else:
                # print("err")
                s.append(n)

        else:
            s.append(n)
    #print(v, s, i)


a = [v[1] for v in s if v[0] == '.']
print(sum(a))
a.insert(0, len(a))
print(" ".join([str(v) for v in a]))

