pos_latest = []

surface = input()

total = []
total_x = []
y = 0
x = 0
total_tmp = 0
for i in range(len(surface)):
    if surface[i] == "\\":
        pos_latest.append(x)
    if surface[i] == "/":
        if pos_latest:
            pos = pos_latest.pop()
            total.append(x-pos)
            total_x.append([pos, x, x-pos])
    x += 1

if sum(total) > 0:
    sorted_total_x = sorted(total_x)
    t_base = sorted_total_x[0][1]
    tmp = sorted_total_x[0][2]
    res = []
    
    for f, t, v in sorted_total_x[1:]:
        if t <= t_base:
            tmp += v
        else:
            res.append(int(tmp))
            tmp = v
            t_base = t
        if sum(res)>=sum(total):
            break
    res.append(int(tmp))

    print(sum(res))
    print(len(res), *res, sep=" ")
    
else:
    print(sum(total))
    print(0)
 pos_latest = [] pos_latest [] surface = input() surface input() input total = [] total [] total_x = [] total_x [] y = 0 y 0 x = 0 x 0 total_tmp = 0 total_tmp 0 for i in range(len(surface)):
    if surface[i] == "\\":
        pos_latest.append(x)
    if surface[i] == "/":
        if pos_latest:
            pos = pos_latest.pop()
            total.append(x-pos)
            total_x.append([pos, x, x-pos])
    x += 1 i range(len(surface)) range len(surface) len surface if surface[i] == "\\":
        pos_latest.append(x)
     surface[i] == "\\" surface[i] surface i "\\" pos_latest.append(x) pos_latest.append pos_latest append x if surface[i] == "/":
        if pos_latest:
            pos = pos_latest.pop()
            total.append(x-pos)
            total_x.append([pos, x, x-pos])
     surface[i] == "/" surface[i] surface i "/" if pos_latest:
            pos = pos_latest.pop()
            total.append(x-pos)
            total_x.append([pos, x, x-pos])
     pos_latest pos = pos_latest.pop() pos pos_latest.pop() pos_latest.pop pos_latest pop total.append(x-pos) total.append total append x-pos x pos total_x.append([pos, x, x-pos]) total_x.append total_x append [pos, x, x-pos] pos x x-pos x pos x += 1 x 1 if sum(total) > 0:
    sorted_total_x = sorted(total_x)
    t_base = sorted_total_x[0][1]
    tmp = sorted_total_x[0][2]
    res = []
    
    for f, t, v in sorted_total_x[1:]:
        if t <= t_base:
            tmp += v
        else:
            res.append(int(tmp))
            tmp = v
            t_base = t
        if sum(res)>=sum(total):
            break
    res.append(int(tmp))

    print(sum(res))
    print(len(res), *res, sep=" ")
    
else:
    print(sum(total))
    print(0) sum(total) > 0 sum(total) sum total 0 sorted_total_x = sorted(total_x) sorted_total_x sorted(total_x) sorted total_x t_base = sorted_total_x[0][1] t_base sorted_total_x[0][1] [0] sorted_total_x 0 1 tmp = sorted_total_x[0][2] tmp sorted_total_x[0][2] [0] sorted_total_x 0 2 res = [] res [] for f, t, v in sorted_total_x[1:]:
        if t <= t_base:
            tmp += v
        else:
            res.append(int(tmp))
            tmp = v
            t_base = t
        if sum(res)>=sum(total):
            break
     f t v sorted_total_x[1:] sorted_total_x 1: 1 if t <= t_base:
            tmp += v
        else:
            res.append(int(tmp))
            tmp = v
            t_base = t
         t <= t_base t t_base tmp += v tmp v res.append(int(tmp)) res.append res append int(tmp) int tmp tmp = v tmp v t_base = t t_base t if sum(res)>=sum(total):
            break
     sum(res)>=sum(total) sum(res) sum res sum(total) sum total break res.append(int(tmp)) res.append res append int(tmp) int tmp print(sum(res)) print sum(res) sum res print(len(res), *res, sep=" ") print len(res) len res *res res sep=" " sep " " print(sum(total)) print sum(total) sum total print(0) print 0 res = [] [] res y = 0 0 y total_tmp = 0 0 total_tmp total = [] [] total t_base = t t t_base x = 0 0 x x += 1 1 x total_x = [] [] total_x tmp = sorted_total_x[0][2] sorted_total_x[0][2] tmp pos_latest = [] [] pos_latest pos = pos_latest.pop() pos_latest.pop() pos tmp = v v tmp sorted_total_x = sorted(total_x) sorted(total_x) sorted_total_x t_base = sorted_total_x[0][1] sorted_total_x[0][1] t_base tmp += v v tmp surface = input() input() surface
pos_latest = []

surface = input()

total = []
total_x = []
y = 0
x = 0
total_tmp = 0
for i in range(len(surface)):
    if surface[i] == "\\":
        pos_latest.append(x)
    if surface[i] == "/":
        if pos_latest:
            pos = pos_latest.pop()
            total.append(x-pos)
            total_x.append([pos, x, x-pos])
    x += 1

if sum(total) > 0:
    sorted_total_x = sorted(total_x)
    t_base = sorted_total_x[0][1]
    tmp = sorted_total_x[0][2]
    res = []
    
    for f, t, v in sorted_total_x[1:]:
        if t <= t_base:
            tmp += v
        else:
            res.append(int(tmp))
            tmp = v
            t_base = t
        if sum(res)>=sum(total):
            break
    res.append(int(tmp))

    print(sum(res))
    print(len(res), *res, sep=" ")
    
else:
    print(sum(total))
    print(0)

