s = input()
stack1 = []
stack2 = []
for i in range(len(s)):
    if s[i] == '\\':
        stack1.append(i)
    elif s[i] == '/' and stack1:
        j = stack1.pop()
        area = i-j
        while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
        stack2.append((j,area))
ans = list(stack2[i][1] for i in range(len(stack2)))
print(sum(ans))
if ans:
    print(len(ans),' '.join(map(str,ans)))
else:
    print(0) s = input() s input() input stack1 = [] stack1 [] stack2 = [] stack2 [] for i in range(len(s)):
    if s[i] == '\\':
        stack1.append(i)
    elif s[i] == '/' and stack1:
        j = stack1.pop()
        area = i-j
        while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
        stack2.append((j,area)) i range(len(s)) range len(s) len s if s[i] == '\\':
        stack1.append(i)
    elif s[i] == '/' and stack1:
        j = stack1.pop()
        area = i-j
        while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
        stack2.append((j,area)) s[i] == '\\' s[i] s i '\\' stack1.append(i) stack1.append stack1 append i elif s[i] == '/' and stack1:
        j = stack1.pop()
        area = i-j
        while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
        stack2.append((j,area)) s[i] == '/' and stack1 s[i] == '/' s[i] s i '/' stack1 j = stack1.pop() j stack1.pop() stack1.pop stack1 pop area = i-j area i-j i j while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
         stack2 if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
         stack2[-1][0] < j stack2[-1][0] [-1] stack2 -1 0 j break area += stack2.pop()[1] area stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append((j,area)) stack2.append stack2 append (j,area) j area ans = list(stack2[i][1] for i in range(len(stack2))) ans list(stack2[i][1] for i in range(len(stack2))) list stack2[i][1] [i] stack2 i 1 print(sum(ans)) print sum(ans) sum ans if ans:
    print(len(ans),' '.join(map(str,ans)))
else:
    print(0) ans print(len(ans),' '.join(map(str,ans))) print len(ans) len ans ' '.join(map(str,ans)) ' '.join ' ' join map(str,ans) map str ans print(0) print 0 s = input() input() s area += stack2.pop()[1] stack2.pop()[1] area stack1 = [] [] stack1 stack2 = [] [] stack2 area = i-j i-j area ans = list(stack2[i][1] for i in range(len(stack2))) list(stack2[i][1] for i in range(len(stack2))) ans j = stack1.pop() stack1.pop() j
s = input()
stack1 = []
stack2 = []
for i in range(len(s)):
    if s[i] == '\\':
        stack1.append(i)
    elif s[i] == '/' and stack1:
        j = stack1.pop()
        area = i-j
        while stack2:
            if stack2[-1][0] < j:
                break
            else:
                area += stack2.pop()[1]
        stack2.append((j,area))
ans = list(stack2[i][1] for i in range(len(stack2)))
print(sum(ans))
if ans:
    print(len(ans),' '.join(map(str,ans)))
else:
    print(0)
