DOWN = []
EDGE = []
POOL = []

for i, c in enumerate(input()):
    if c == '\\':
        DOWN.append(i)
    elif c == '/':
        if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li)

print(sum(POOL))
print(len(POOL), *POOL) DOWN = [] DOWN [] EDGE = [] EDGE [] POOL = [] POOL [] for i, c in enumerate(input()):
    if c == '\\':
        DOWN.append(i)
    elif c == '/':
        if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li) i c enumerate(input()) enumerate input() input if c == '\\':
        DOWN.append(i)
    elif c == '/':
        if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li) c == '\\' c '\\' DOWN.append(i) DOWN.append DOWN append i elif c == '/':
        if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li) c == '/' c '/' if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li) DOWN e = DOWN.pop() e DOWN.pop() DOWN.pop DOWN pop Li = i - e Li i - e i e while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
             EDGE if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
             EDGE[-1] > e EDGE[-1] EDGE -1 e EDGE.pop() EDGE.pop EDGE pop Li += POOL.pop() Li POOL.pop() POOL.pop POOL pop break EDGE.append(e) EDGE.append EDGE append e POOL.append(Li) POOL.append POOL append Li print(sum(POOL)) print sum(POOL) sum POOL print(len(POOL), *POOL) print len(POOL) len POOL *POOL POOL e = DOWN.pop() DOWN.pop() e Li = i - e i - e Li EDGE = [] [] EDGE DOWN = [] [] DOWN Li += POOL.pop() POOL.pop() Li POOL = [] [] POOL
DOWN = []
EDGE = []
POOL = []

for i, c in enumerate(input()):
    if c == '\\':
        DOWN.append(i)
    elif c == '/':
        if DOWN:
            e = DOWN.pop()
            Li = i - e # Calcurate 1 line.  \______/ 
            while EDGE: # Merge connected pools.
                if EDGE[-1] > e:
                    EDGE.pop()
                    Li += POOL.pop()
                else:
                    break
            EDGE.append(e)
            POOL.append(Li)

print(sum(POOL))
print(len(POOL), *POOL)