#include<stdio.h>

#define MAXLEN 20000

typedef struct Pool {
	int position;
	int area;
} P;
char buf[ MAXLEN+2 ];
int stack[ MAXLEN+2 ];
P areas[ 10002 ];
int sindex, aindex;

int main( int argc, char *argv[] ) 
{
	int pool, sum = 0;
	int i, j;

	fgets( buf, MAXLEN, stdin );	
	sindex = aindex = 0;
	for( i=0; '\0'!=buf[i]; i++ ) {
		if( '\\' == buf[i] ) {
			stack[ sindex++ ] = i;
		} else if( 0 < sindex && '/' == buf[i] ) {
			j = stack[ --sindex ];
			pool = i - j;
			sum += pool;
			while( 0 < aindex ) {
				if( j < areas[ aindex-1 ].position ) {
					pool += areas[ --aindex ].area;
				} else {
					break;
				}
			}
			areas[ aindex ].position = j;
			areas[ aindex++ ].area = pool;
		}
	}
	printf( "%d\n", sum );
    if( 0 < aindex ) {
        printf( "%d ", aindex );
    } else {
    	printf( "%d", aindex );
    }
    for( i=0; i<aindex; i++ ) {
        printf( "%d", areas[ i ].area );
        if( i != aindex-1 ) printf( " " );
    }
    printf( "\n" );
    
    return 0;
}