def cal_water(floods):
    fstack = []
    astack = []
    i = 0
    for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
    tot = 0
    tot_area = 0
    out = ''
    while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
    print(tot_area)
    print(str(tot) +  out)

if __name__ == '__main__':
    floods = input()
    cal_water(floods) def cal_water(floods):
    fstack = []
    astack = []
    i = 0
    for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
    tot = 0
    tot_area = 0
    out = ''
    while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
    print(tot_area)
    print(str(tot) +  out) cal_water fstack = [] fstack [] astack = [] astack [] i = 0 i 0 for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
     flood floods if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
         flood == '\\' flood '\\' fstack.append(i) fstack.append fstack append i elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
         flood == '/' and len(fstack) > 0 flood == '/' flood '/' len(fstack) > 0 len(fstack) len fstack 0 s = fstack.pop(-1) s fstack.pop(-1) fstack.pop fstack pop -1 area = (i - s) * 1 area (i - s) * 1 i - s i s 1 while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
             len(astack) > 0 and astack[-1][0] > s len(astack) > 0 len(astack) len astack 0 astack[-1][0] > s astack[-1][0] [-1] astack -1 0 s _, a = astack.pop(-1) _ astack.pop(-1) astack.pop astack pop -1 a area += a area a astack.append((s, area)) astack.append astack append (s, area) s area i += 1 i 1 tot = 0 tot 0 tot_area = 0 tot_area 0 out = '' out '' while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
     len(astack) > 0 len(astack) len astack 0 _, area = astack.pop() _ astack.pop() astack.pop astack pop area tot += 1 tot 1 tot_area += area tot_area area out = ' ' + str(area) + out out ' ' + str(area) + out ' ' + str(area) ' ' str(area) str area out print(tot_area) print tot_area print(str(tot) +  out) print str(tot) +  out str(tot) str tot out floods floods if __name__ == '__main__':
    floods = input()
    cal_water(floods) __name__ == '__main__' __name__ '__main__' floods = input() floods input() input cal_water(floods) cal_water floods def cal_water(floods):
    fstack = []
    astack = []
    i = 0
    for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
    tot = 0
    tot_area = 0
    out = ''
    while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
    print(tot_area)
    print(str(tot) +  out) def cal_water(floods):
    fstack = []
    astack = []
    i = 0
    for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
    tot = 0
    tot_area = 0
    out = ''
    while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
    print(tot_area)
    print(str(tot) +  out) cal_water floods = input() input() floods
def cal_water(floods):
    fstack = []
    astack = []
    i = 0
    for flood in floods:
        if flood == '\\':
            fstack.append(i)
        elif flood == '/' and len(fstack) > 0:
            s = fstack.pop(-1)
            area = (i - s) * 1
            while len(astack) > 0 and astack[-1][0] > s:
                _, a = astack.pop(-1)
                area += a
            astack.append((s, area))   
        else:
            pass
        i += 1
    
    tot = 0
    tot_area = 0
    out = ''
    while len(astack) > 0:
        _, area = astack.pop()
        tot += 1
        tot_area += area
        out = ' ' + str(area) + out
    
    print(tot_area)
    print(str(tot) +  out)

if __name__ == '__main__':
    floods = input()
    cal_water(floods)
