ch = input()
stk1 = []
stk2 = []
ttlar = 0
for i, c in enumerate(ch):
    if c == '\\':
        stk1.append(i)
    elif c == '/' and stk1 != []:
        j = stk1.pop()
        ttlar += i - j
        lar = i - j
        while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
        stk2.append([j, lar])
print(ttlar)
ans = [len(stk2)]
ans[1:1] = [stk2[i][1] for i in range(len(stk2))]
print(' '.join(map(str, ans))) ch = input() ch input() input stk1 = [] stk1 [] stk2 = [] stk2 [] ttlar = 0 ttlar 0 for i, c in enumerate(ch):
    if c == '\\':
        stk1.append(i)
    elif c == '/' and stk1 != []:
        j = stk1.pop()
        ttlar += i - j
        lar = i - j
        while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
        stk2.append([j, lar]) i c enumerate(ch) enumerate ch if c == '\\':
        stk1.append(i)
    elif c == '/' and stk1 != []:
        j = stk1.pop()
        ttlar += i - j
        lar = i - j
        while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
        stk2.append([j, lar]) c == '\\' c '\\' stk1.append(i) stk1.append stk1 append i elif c == '/' and stk1 != []:
        j = stk1.pop()
        ttlar += i - j
        lar = i - j
        while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
        stk2.append([j, lar]) c == '/' and stk1 != [] c == '/' c '/' stk1 != [] stk1 [] j = stk1.pop() j stk1.pop() stk1.pop stk1 pop ttlar += i - j ttlar i - j i j lar = i - j lar i - j i j while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
         stk2 != [] and stk2[-1][0] > j stk2 != [] stk2 [] stk2[-1][0] > j stk2[-1][0] [-1] stk2 -1 0 j lar += stk2.pop()[1] lar stk2.pop()[1] stk2.pop() stk2.pop stk2 pop 1 stk2.append([j, lar]) stk2.append stk2 append [j, lar] j lar print(ttlar) print ttlar ans = [len(stk2)] ans [len(stk2)] len(stk2) len stk2 stk2[i][1] for i in range(len(stk2)) for i in range(len(stk2)) i range(len(stk2)) range len(stk2) len stk2 for i in range(len(stk2)) stk2[i][1] [i] stk2 i 1 ans[1:1] = [stk2[i][1] for i in range(len(stk2))] ans[1:1] ans 1:1 1 1 [stk2[i][1] for i in range(len(stk2))] print(' '.join(map(str, ans))) print ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans ttlar += i - j i - j ttlar ch = input() input() ch ttlar = 0 0 ttlar j = stk1.pop() stk1.pop() j ans = [len(stk2)] [len(stk2)] ans lar += stk2.pop()[1] stk2.pop()[1] lar stk2 = [] [] stk2 lar = i - j i - j lar stk1 = [] [] stk1
ch = input()
stk1 = []
stk2 = []
ttlar = 0
for i, c in enumerate(ch):
    if c == '\\':
        stk1.append(i)
    elif c == '/' and stk1 != []:
        j = stk1.pop()
        ttlar += i - j
        lar = i - j
        while stk2 != [] and stk2[-1][0] > j:
            lar += stk2.pop()[1]
        stk2.append([j, lar])
print(ttlar)
ans = [len(stk2)]
ans[1:1] = [stk2[i][1] for i in range(len(stk2))]
print(' '.join(map(str, ans)))
