def main():
    
    from collections import deque

    s = input()
    s1 = deque([])
    s2 = deque([])

    sum_ = 0
    
    for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
    ans = []
    
    while len(s2)>0:
        ans.append(s2.pop()[1])
        
    ans.reverse()
    print(sum(ans))
    ans.insert(0, len(ans))
    
    print(' '.join(map(str, ans)))

    
            
if __name__ == '__main__':
    main() def main():
    
    from collections import deque

    s = input()
    s1 = deque([])
    s2 = deque([])

    sum_ = 0
    
    for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
    ans = []
    
    while len(s2)>0:
        ans.append(s2.pop()[1])
        
    ans.reverse()
    print(sum(ans))
    ans.insert(0, len(ans))
    
    print(' '.join(map(str, ans)))

    
             main from collections import deque s = input() s input() input s1 = deque([]) s1 deque([]) deque [] s2 = deque([]) s2 deque([]) deque [] sum_ = 0 sum_ 0 for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
     i ch enumerate(s) enumerate s if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
     ch == '\\' ch '\\' s1.append(i) s1.append s1 append i elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
     ch =='/' and len(s1) > 0 ch =='/' ch '/' len(s1) > 0 len(s1) len s1 0 j = s1.pop() j s1.pop() s1.pop s1 pop sum_ += i - j sum_ i - j i j a = i- j a i- j i j while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
             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 a += s2.pop()[1] a s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([j, a]) s2.append s2 append [j, a] j a ans = [] ans [] while len(s2)>0:
        ans.append(s2.pop()[1])
        
     len(s2)>0 len(s2) len s2 0 ans.append(s2.pop()[1]) ans.append ans append s2.pop()[1] s2.pop() s2.pop s2 pop 1 ans.reverse() ans.reverse ans reverse print(sum(ans)) print sum(ans) sum ans ans.insert(0, len(ans)) ans.insert ans insert 0 len(ans) len ans print(' '.join(map(str, ans))) print ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    
    from collections import deque

    s = input()
    s1 = deque([])
    s2 = deque([])

    sum_ = 0
    
    for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
    ans = []
    
    while len(s2)>0:
        ans.append(s2.pop()[1])
        
    ans.reverse()
    print(sum(ans))
    ans.insert(0, len(ans))
    
    print(' '.join(map(str, ans)))

    
             def main():
    
    from collections import deque

    s = input()
    s1 = deque([])
    s2 = deque([])

    sum_ = 0
    
    for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
    ans = []
    
    while len(s2)>0:
        ans.append(s2.pop()[1])
        
    ans.reverse()
    print(sum(ans))
    ans.insert(0, len(ans))
    
    print(' '.join(map(str, ans)))

    
             main
def main():
    
    from collections import deque

    s = input()
    s1 = deque([])
    s2 = deque([])

    sum_ = 0
    
    for i, ch in enumerate(s):
        if ch == '\\' :
            s1.append(i)
            
        elif ch =='/' and len(s1) > 0:
            j = s1.pop()
            sum_ += i - j
            a = i- j
            while len(s2) > 0 and s2[-1][0] > j:
                a += s2.pop()[1]
            s2.append([j, a])
            
    ans = []
    
    while len(s2)>0:
        ans.append(s2.pop()[1])
        
    ans.reverse()
    print(sum(ans))
    ans.insert(0, len(ans))
    
    print(' '.join(map(str, ans)))

    
            
if __name__ == '__main__':
    main()
