#include<stdio.h>

#define MAX 1000



int EACH_AREA_Decision(int snd_stk[], int each_area[], int s_idx)//各水溜まりの面積を求めた時点で、それ以前にその水溜まりより高い水溜まりがないかを確認する。
{
	int share_count = 0,
		number = 0,
		pool_number = 0,
		pool_count = 0,
		f_cnt = 0;

	while (1) {
		pool_number++;
		if (each_area[pool_number] == 0) {
			pool_number--;
			break;
		}
	}

	share_count = 1;
	s_idx -= 1;

	while ((pool_number - share_count) != -1) { 

		if (snd_stk[s_idx] < snd_stk[s_idx - share_count]) {//判定した水溜まりとそれ以前の水溜まりが同じ以下の高さであれば（※数値上では高ければ）その間にある水溜まりを結合する。
			each_area[pool_number - share_count] += each_area[pool_number - pool_count];//判定されたほうに入れていく
			snd_stk[s_idx - share_count] = 0;
			each_area[pool_number - pool_count] = 0;//初期化
			
			pool_count++;
		}
		else if (snd_stk[s_idx] >= snd_stk[s_idx - share_count]) {//
			break;
		}

		share_count++;//判定したところから結合する部分まで
		
	}
	share_count -= 1;
	snd_stk[s_idx - share_count] = snd_stk[s_idx];

	return share_count;
}


int main(void)
{

	int fst_stk[MAX] = { 0 }, f_idx = 0,
		snd_stk[MAX] = { 0 }, s_idx = 0,
		each_area[MAX] = { 0 }, e_idx = 0,
		ALL_area = 0;

	int i_idx = 0,
		d_count = 0,
		f_cnt = 0,
		distance = 0,
		TOP = 0;


	char input[MAX];

	fgets(input, MAX, stdin);


	while (input[i_idx] != '\n') {

		switch (input[i_idx]) {
		case '\\':
			

			d_count++;
			fst_stk[f_idx] = d_count;
			f_idx++;
			i_idx++;
			break;


		case '/':
			if (d_count == 0) {
				snd_stk[s_idx] = 1;
				s_idx++;
				i_idx++;
				break;
			}

			

			fst_stk[f_idx] = d_count;

			for (f_cnt = f_idx - 1; f_cnt >= 0; f_cnt--) {//Ｘ軸の面積を求める
				distance++;
				if (fst_stk[f_idx] == fst_stk[f_cnt]) {
					each_area[e_idx] = distance;
					e_idx++;
					snd_stk[s_idx] = d_count;//水溜まりの深さを一時的に格納
					s_idx++;
					distance = 0;//次に使うために初期化

					f_cnt = EACH_AREA_Decision(snd_stk, each_area, s_idx);//水溜まりを結合していた場合、帳尻を合わせる
					
					e_idx -= f_cnt;//結合した分の帳尻を合わせる
					s_idx -= f_cnt;
					break;
				}
			}

			d_count--;
			f_idx++;
			i_idx++;

			break;


		case '_':
			if (d_count == 0) {
				i_idx++;
				break;
			}
			fst_stk[f_idx] = -1;
			f_idx++;
			i_idx++;
			break;

		}
	}

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		ALL_area += each_area[f_cnt];
	}

	printf("%d\n", ALL_area);
	printf("%d", e_idx);

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		printf(" %d", each_area[f_cnt]);
	}
	putchar('\n');

	return 0;

}
