#coding:utf-8
data = input()
xmax = len(data)
data_list = list(data)
data_list.reverse()
reverse_data = []
for sig in data_list:
    if sig == "\\":
        reverse_data.append("/")
    elif sig == "/":
        reverse_data.append("\\")
    else:
        reverse_data.append(sig)

reverse_data = "".join(reverse_data)


def partialSqu(h, sig):
    if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
    return squ, h


x_squ_dict = {}
cnt = 0
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in data:
    x += 1
    if sw == 0 and sig == "\\":
        sw = 1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ
        
        if h == 0:
            x_squ_dict[x] = totalSqu
            totalSqu = 0
            sw = 0



keys = x_squ_dict.keys()
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in reverse_data:
    x += 1
    if sw == 0 and sig == "\\" :
        sw = 1
        x_p = xmax - x +1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ            
        if h == 0:
            x_squ_dict[x_p] = totalSqu
            totalSqu = 0
            sw = 0


keys = x_squ_dict.keys()
keys = list(keys)
keys.sort()
squ_list = []
for key in keys:
    squ_list.append(x_squ_dict[key])
    
a = int(sum(squ_list))
print(a)    
squ_list.insert(0,len(keys))

squ_list = " ".join([str(int(num)) for num in squ_list])
print(squ_list)


 data = input() data input() input xmax = len(data) xmax len(data) len data data_list = list(data) data_list list(data) list data data_list.reverse() data_list.reverse data_list reverse reverse_data = [] reverse_data [] for sig in data_list:
    if sig == "\\":
        reverse_data.append("/")
    elif sig == "/":
        reverse_data.append("\\")
    else:
        reverse_data.append(sig) sig data_list if sig == "\\":
        reverse_data.append("/")
    elif sig == "/":
        reverse_data.append("\\")
    else:
        reverse_data.append(sig) sig == "\\" sig "\\" reverse_data.append("/") reverse_data.append reverse_data append "/" elif sig == "/":
        reverse_data.append("\\")
     sig == "/" sig "/" reverse_data.append("\\") reverse_data.append reverse_data append "\\" reverse_data.append(sig) reverse_data.append reverse_data append sig reverse_data = "".join(reverse_data) reverse_data "".join(reverse_data) "".join "" join reverse_data def partialSqu(h, sig):
    if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
    return squ, h partialSqu if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
     sig == "\\" sig "\\" squ = h + 1/2 squ h + 1/2 h 1/2 1 2 h += 1 h 1 elif sig == "/":
        squ = h - 1/2
        h -= 1
     sig == "/" sig "/" squ = h - 1/2 squ h - 1/2 h 1/2 1 2 h -= 1 h 1 elif sig == "_":
        squ = h
     sig == "_" sig "_" squ = h squ h return squ, h return squ, h squ h h h sig sig x_squ_dict = {} x_squ_dict {} cnt = 0 cnt 0 sw, x, h, totalSqu = 0, 0, 0, 0 sw 0 x 0 h 0 totalSqu 0 for sig in data:
    x += 1
    if sw == 0 and sig == "\\":
        sw = 1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ
        
        if h == 0:
            x_squ_dict[x] = totalSqu
            totalSqu = 0
            sw = 0 sig data x += 1 x 1 if sw == 0 and sig == "\\":
        sw = 1
     sw == 0 and sig == "\\" sw == 0 sw 0 sig == "\\" sig "\\" sw = 1 sw 1 if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ
        
        if h == 0:
            x_squ_dict[x] = totalSqu
            totalSqu = 0
            sw = 0 sw == 1 sw 1 squ, h = partialSqu(h, sig) squ partialSqu(h, sig) partialSqu h sig h totalSqu += squ totalSqu squ if h == 0:
            x_squ_dict[x] = totalSqu
            totalSqu = 0
            sw = 0 h == 0 h 0 x_squ_dict[x] = totalSqu x_squ_dict[x] x_squ_dict x totalSqu totalSqu = 0 totalSqu 0 sw = 0 sw 0 keys = x_squ_dict.keys() keys x_squ_dict.keys() x_squ_dict.keys x_squ_dict keys sw, x, h, totalSqu = 0, 0, 0, 0 sw 0 x 0 h 0 totalSqu 0 for sig in reverse_data:
    x += 1
    if sw == 0 and sig == "\\" :
        sw = 1
        x_p = xmax - x +1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ            
        if h == 0:
            x_squ_dict[x_p] = totalSqu
            totalSqu = 0
            sw = 0 sig reverse_data x += 1 x 1 if sw == 0 and sig == "\\" :
        sw = 1
        x_p = xmax - x +1
     sw == 0 and sig == "\\" sw == 0 sw 0 sig == "\\" sig "\\" sw = 1 sw 1 x_p = xmax - x +1 x_p xmax - x +1 xmax - x xmax x 1 if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ            
        if h == 0:
            x_squ_dict[x_p] = totalSqu
            totalSqu = 0
            sw = 0 sw == 1 sw 1 squ, h = partialSqu(h, sig) squ partialSqu(h, sig) partialSqu h sig h totalSqu += squ totalSqu squ if h == 0:
            x_squ_dict[x_p] = totalSqu
            totalSqu = 0
            sw = 0 h == 0 h 0 x_squ_dict[x_p] = totalSqu x_squ_dict[x_p] x_squ_dict x_p totalSqu totalSqu = 0 totalSqu 0 sw = 0 sw 0 keys = x_squ_dict.keys() keys x_squ_dict.keys() x_squ_dict.keys x_squ_dict keys keys = list(keys) keys list(keys) list keys keys.sort() keys.sort keys sort squ_list = [] squ_list [] for key in keys:
    squ_list.append(x_squ_dict[key])
     key keys squ_list.append(x_squ_dict[key]) squ_list.append squ_list append x_squ_dict[key] x_squ_dict key a = int(sum(squ_list)) a int(sum(squ_list)) int sum(squ_list) sum squ_list print(a) print a squ_list.insert(0,len(keys)) squ_list.insert squ_list insert 0 len(keys) len keys str(int(num)) for num in squ_list for num in squ_list num squ_list for num in squ_list str(int(num)) str int(num) int num squ_list = " ".join([str(int(num)) for num in squ_list]) squ_list " ".join([str(int(num)) for num in squ_list]) " ".join " " join [str(int(num)) for num in squ_list] print(squ_list) print squ_list sw = 1 1 sw reverse_data = "".join(reverse_data) "".join(reverse_data) reverse_data sw = 1 1 sw sw = 0 0 sw h, totalSqu = 0, 0, 0, 0 0 h sw, x, h, totalSqu = 0, 0, 0, 0 0 sw a = int(sum(squ_list)) int(sum(squ_list)) a x += 1 1 x xmax = len(data) len(data) xmax def partialSqu(h, sig):
    if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
    return squ, h def partialSqu(h, sig):
    if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
    return squ, h partialSqu sw = 0 0 sw sw, x, h, totalSqu = 0, 0, 0, 0 0 sw squ_list = " ".join([str(int(num)) for num in squ_list]) " ".join([str(int(num)) for num in squ_list]) squ_list data = input() input() data h, totalSqu = 0, 0, 0, 0 0 h x, h, totalSqu = 0, 0, 0, 0 0 x x += 1 1 x squ, h = partialSqu(h, sig) partialSqu(h, sig) squ cnt = 0 0 cnt keys = x_squ_dict.keys() x_squ_dict.keys() keys totalSqu += squ squ totalSqu totalSqu += squ squ totalSqu h = partialSqu(h, sig) partialSqu(h, sig) h totalSqu = 0 0 totalSqu keys = x_squ_dict.keys() x_squ_dict.keys() keys x_p = xmax - x +1 xmax - x +1 x_p squ_list = [] [] squ_list totalSqu = 0, 0, 0, 0 0 totalSqu x_squ_dict = {} {} x_squ_dict squ, h = partialSqu(h, sig) partialSqu(h, sig) squ data_list = list(data) list(data) data_list totalSqu = 0 0 totalSqu reverse_data = [] [] reverse_data totalSqu = 0, 0, 0, 0 0 totalSqu h = partialSqu(h, sig) partialSqu(h, sig) h x, h, totalSqu = 0, 0, 0, 0 0 x keys = list(keys) list(keys) keys
#coding:utf-8
data = input()
xmax = len(data)
data_list = list(data)
data_list.reverse()
reverse_data = []
for sig in data_list:
    if sig == "\\":
        reverse_data.append("/")
    elif sig == "/":
        reverse_data.append("\\")
    else:
        reverse_data.append(sig)

reverse_data = "".join(reverse_data)


def partialSqu(h, sig):
    if sig == "\\":
        squ = h + 1/2
        h += 1
    elif sig == "/":
        squ = h - 1/2
        h -= 1
    elif sig == "_":
        squ = h
    return squ, h


x_squ_dict = {}
cnt = 0
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in data:
    x += 1
    if sw == 0 and sig == "\\":
        sw = 1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ
        
        if h == 0:
            x_squ_dict[x] = totalSqu
            totalSqu = 0
            sw = 0



keys = x_squ_dict.keys()
sw, x, h, totalSqu = 0, 0, 0, 0
for sig in reverse_data:
    x += 1
    if sw == 0 and sig == "\\" :
        sw = 1
        x_p = xmax - x +1
    if sw == 1 :
        squ, h = partialSqu(h, sig)
        totalSqu += squ            
        if h == 0:
            x_squ_dict[x_p] = totalSqu
            totalSqu = 0
            sw = 0


keys = x_squ_dict.keys()
keys = list(keys)
keys.sort()
squ_list = []
for key in keys:
    squ_list.append(x_squ_dict[key])
    
a = int(sum(squ_list))
print(a)    
squ_list.insert(0,len(keys))

squ_list = " ".join([str(int(num)) for num in squ_list])
print(squ_list)



