x = input()
y = []
z = []
n = 0
for i in range(len(x)):
    if x[i] == '\\':
        if n:
            y.append(n)
            n = 0
            if z:
                z.append(-1)
        z.append(i)
    elif x[i] == '/':
        if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
    else:
        pass
if n:
    y.append(n)
for j in range(y.count(0)):
    y.remove(0)
print(sum(y))
print(len(y), *y)

 x = input() x input() input y = [] y [] z = [] z [] n = 0 n 0 for i in range(len(x)):
    if x[i] == '\\':
        if n:
            y.append(n)
            n = 0
            if z:
                z.append(-1)
        z.append(i)
    elif x[i] == '/':
        if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
    else:
        pass i range(len(x)) range len(x) len x if x[i] == '\\':
        if n:
            y.append(n)
            n = 0
            if z:
                z.append(-1)
        z.append(i)
    elif x[i] == '/':
        if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
    else:
        pass x[i] == '\\' x[i] x i '\\' if n:
            y.append(n)
            n = 0
            if z:
                z.append(-1)
         n y.append(n) y.append y append n n = 0 n 0 if z:
                z.append(-1)
         z z.append(-1) z.append z append -1 z.append(i) z.append z append i elif x[i] == '/':
        if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
     x[i] == '/' x[i] x i '/' if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
     z while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
             True p = z.pop() p z.pop() z.pop z pop if p == -1:
                    n += y.pop()
                else:
                    break
             p == -1 p -1 n += y.pop() n y.pop() y.pop y pop break n += i-p n i-p i p if n:
    y.append(n) n y.append(n) y.append y append n for j in range(y.count(0)):
    y.remove(0) j range(y.count(0)) range y.count(0) y.count y count 0 y.remove(0) y.remove y remove 0 print(sum(y)) print sum(y) sum y print(len(y), *y) print len(y) len y *y y n = 0 0 n p = z.pop() z.pop() p n += i-p i-p n n = 0 0 n y = [] [] y n += y.pop() y.pop() n z = [] [] z x = input() input() x
x = input()
y = []
z = []
n = 0
for i in range(len(x)):
    if x[i] == '\\':
        if n:
            y.append(n)
            n = 0
            if z:
                z.append(-1)
        z.append(i)
    elif x[i] == '/':
        if z:
            while True:
                p = z.pop()
                if p == -1:
                    n += y.pop()
                else:
                    break
            n += i-p
    else:
        pass
if n:
    y.append(n)
for j in range(y.count(0)):
    y.remove(0)
print(sum(y))
print(len(y), *y)


