#include<stdio.h>
#include<stdlib.h>
#define MAX 20000

typedef struct{
	int top;
	int S[MAX];
}Stack;

void initialize(Stack *st)
{
	st->top = 0;
	st->S[st->top] = 0;
}

int isEmpty(Stack *st)
{
	return st->top == 0;
}

int isFull(Stack *st)
{
	return st->top >= MAX -1;
}

void push(int x, Stack *st)
{
	if(isFull(st))
	exit(1);
	
	st->top++;
	st->S[st->top] = x;
}

int pop(Stack *st)
{
	if(isEmpty(st))
	exit(1);
	
	st->top--;
	return st->S[st->top+1];
}

int main(void)
{
	Stack st1;
	Stack st2_j;
	Stack st2_a;
	
	initialize(&st1);
	initialize(&st2_j);
	initialize(&st2_a);
	
	char c;
	int sum = 0;
	
	for(int i = 0; (c = getchar()) != EOF; i++)
	{
		if(c == '\\')
		{
			push(i,&st1);
		}
		else if(!isEmpty(&st1) && c == '/')
		{
			int j=pop(&st1);
			sum += i-j;
			int a = i - j;
			while(!isEmpty(&st2_j)&& st2_j.S[st2_j.top]>j)
			{
				pop(&st2_j);
				a+=pop(&st2_a);
			
			}
			push(j,&st2_j);
			push(a,&st2_a);
		}
	}
		
		printf("%d\n",sum);
		printf("%d",st2_a.top);
		
		for(int i = 1; i<=st2_a.top; i++)
		 printf(" %d",st2_a.S[i]);
			printf("\n");
			
		
		
		return 0;
	}
