#include<stdio.h>
#define SLOPE_STACK_MAX 20000
#define SECTION_STACK_MAX  10000
typedef struct slope_stack_tag{
	int size;
	int (*push)(struct slope_stack_tag *, int);
	int (*pop )(struct slope_stack_tag *);
	int (*top )(struct slope_stack_tag *);
	int slope[SLOPE_STACK_MAX];
} slope_stack;
typedef struct{
	int start;
	int area ;
} section_t;
typedef struct section_stack_tag{
	int size;
	int        (*push)(struct section_stack_tag *, section_t *);
	int        (*pop )(struct section_stack_tag *);
	section_t* (*top )(struct section_stack_tag *);
	section_t section[SECTION_STACK_MAX];
} section_stack;

int slope_pop(slope_stack* ps){
	if(ps->size == 0)
		return -1;
	--ps->size;
	return ps->size;
}
int slope_top(slope_stack* ps){
	return ps->slope[ps->size-1];
}
int slope_push(slope_stack* ps, int slope){
	if(ps->size >= SLOPE_STACK_MAX)
		return -1;
	ps->slope[ps->size] = slope;
	++ps->size;
	return 0;
}
void slope_init(slope_stack* ps){
	ps->size = 0;
	ps->pop = slope_pop;
	ps->top = slope_top;
	ps->push = slope_push;
	return;
}

int section_pop(section_stack* ps){
	if(ps->size == 0)
		return -1;
	--ps->size;
	return ps->size;
}
section_t* section_top(section_stack* ps){
	return &ps->section[ps->size-1];
}
int section_push(section_stack* pss, section_t *pst){
	if(pss->size >= SECTION_STACK_MAX)
		return -1;
	pss->section[pss->size].start = pst->start;
	pss->section[pss->size].area  = pst->area ;
	++pss->size;
	return 0;
}
void section_init(section_stack* ps){
	ps->size = 0;
	ps->pop = section_pop;
	ps->top = section_top;
	ps->push = section_push;
	return;
}
// -------------------------------------------------------------
void add_section(section_stack* pss, section_t* pst){
	if(pss->size == 0 || pss->top(pss)->start < pst->start){
		pss->push(pss, pst);
	}else{
		pst->area += pss->top(pss)->area;
		pss->pop(pss);
		add_section(pss, pst);
	}
	return;
}

int main(void){
	slope_stack   slope_s  ;
	section_stack section_s;
	section_t     section  ;
	char          c        ;
	int           i    = -1,
		      area = 0 ;

	slope_init(&slope_s);
	section_init(&section_s);

	while(EOF != scanf("%c", &c)){
		++i;
		if(c == '\\'){
			slope_s.push(&slope_s, i);
		}else if(c == '/'){
			if(slope_s.size != 0){
				section.start = slope_s.top(&slope_s);
				section.area  = i - slope_s.top(&slope_s);
				slope_s.pop(&slope_s);
				area         += section.area;
				add_section(&section_s, &section);
			}
		}else if(c == '_'){
			continue;
		}else{
			break;
		}
	}
	printf("%d\n%d", area, section_s.size);
	for(i=0; i<section_s.size; ++i){
		printf(" %d", section_s.section[i].area);
	}
	printf("\n");

	return 0;
}