open List
let rec($)l=function[]->l|[e]->e::l|((a,b),s)as x::((((c,d),t)::z)as y)->if a<c&&b>d then l$(((a,b),s+t)::z)else(x::l)$y
let a=[]$(fold_left(fun(i,q,w)x->match x with|'_'->i+1,q,w|'\\'->i+1,i::q,w|_->(match q with[]->i+1,q,w|j::o->i+1,o,((j,i),i-j)::w))(0,[],[])(let s=read_line()in let a=ref[]in for i=String.length s-1downto 0do a:=s.[i]::!a done;!a)|>fun(_,_,t)->t);;Printf.printf"%d
"(fold_left(fun z(_,n)->z+n)0 a);print_int(length a);iter(fun(_,n)->Printf.printf" %d"n)a;print_newline()