string = input()

s = []
total = 0
s2 = []
for i in range(len(string)):
    if string[i] == '\\':
        s.append(i)
    elif string[i] == '/' and len(s) > 0:
        j = s.pop() # j: 対応する '\' の位置
        area = i - j # 面積
        total += area
        while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
        s2.append([j, area]) # j: 水たまりの左端 / tmp: その水たまりの面積

ans = []
for i in range(len(s2)):
    ans.append(str(s2[i][1]))

print(total)
if len(ans) == 0:
    print(len(ans))
else:
    print(len(ans), end = ' ')
    print(' '.join(ans)) string = input() string input() input s = [] s [] total = 0 total 0 s2 = [] s2 [] for i in range(len(string)):
    if string[i] == '\\':
        s.append(i)
    elif string[i] == '/' and len(s) > 0:
        j = s.pop() # j: 対応する '\' の位置
        area = i - j # 面積
        total += area
        while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
        s2.append([j, area]) # j: 水たまりの左端 / tmp: その水たまりの面積 i range(len(string)) range len(string) len string if string[i] == '\\':
        s.append(i)
    elif string[i] == '/' and len(s) > 0:
        j = s.pop() # j: 対応する '\' の位置
        area = i - j # 面積
        total += area
        while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
        s2.append([j, area]) # j: 水たまりの左端 / tmp: その水たまりの面積 string[i] == '\\' string[i] string i '\\' s.append(i) s.append s append i elif string[i] == '/' and len(s) > 0:
        j = s.pop() # j: 対応する '\' の位置
        area = i - j # 面積
        total += area
        while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
        s2.append([j, area]) # j: 水たまりの左端 / tmp: その水たまりの面積 string[i] == '/' and len(s) > 0 string[i] == '/' string[i] string i '/' len(s) > 0 len(s) len s 0 j = s.pop() j s.pop() s.pop s pop area = i - j area i - j i j total += area total area while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
         len(s2) > 0 and s2[-1][0] > j len(s2) > 0 len(s2) len s2 0 s2[-1][0] > j s2[-1][0] [-1] s2 -1 0 j area += s2[-1][1] area s2[-1][1] [-1] s2 -1 1 s2.pop() s2.pop s2 pop s2.append([j, area]) s2.append s2 append [j, area] j area ans = [] ans [] for i in range(len(s2)):
    ans.append(str(s2[i][1])) i range(len(s2)) range len(s2) len s2 ans.append(str(s2[i][1])) ans.append ans append str(s2[i][1]) str s2[i][1] [i] s2 i 1 print(total) print total if len(ans) == 0:
    print(len(ans))
else:
    print(len(ans), end = ' ')
    print(' '.join(ans)) len(ans) == 0 len(ans) len ans 0 print(len(ans)) print len(ans) len ans print(len(ans), end = ' ') print len(ans) len ans end = ' ' end ' ' print(' '.join(ans)) print ' '.join(ans) ' '.join ' ' join ans s = [] [] s total = 0 0 total area = i - j i - j area string = input() input() string area += s2[-1][1] s2[-1][1] area j = s.pop() s.pop() j s2 = [] [] s2 total += area area total ans = [] [] ans
string = input()

s = []
total = 0
s2 = []
for i in range(len(string)):
    if string[i] == '\\':
        s.append(i)
    elif string[i] == '/' and len(s) > 0:
        j = s.pop() # j: 対応する '\' の位置
        area = i - j # 面積
        total += area
        while len(s2) > 0 and s2[-1][0] > j: # s2[-1][0] == s2.pop()[0]
            area += s2[-1][1]
            s2.pop()
        s2.append([j, area]) # j: 水たまりの左端 / tmp: その水たまりの面積

ans = []
for i in range(len(s2)):
    ans.append(str(s2[i][1]))

print(total)
if len(ans) == 0:
    print(len(ans))
else:
    print(len(ans), end = ' ')
    print(' '.join(ans))
