#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define listcount 100000

int main() {
	//文字列
	char type[20001];
	//左スラッシュの数
	int LeftWall[listcount];
	
	int LeftWall_count[listcount];
	//深さ
	int depth = 0;
	
	//水たまりの数
	int count = 0;
	//各水たまりの面積
	int puddlevalue[listcount];
	int puddle_Left[listcount];
	
	
	scanf("%s", type);
	for(int i = 0; type[i] != '\0'; i++){
//		printf("%c ", type[i]);
		if(type[i] == '\\'){
//			printf("type1\n");
			depth++;
			LeftWall[depth] = i;
		}else if(type[i] == '/'){
//			printf("type2");
			if(depth > 0){
				int value = i - LeftWall[depth];
				puddlevalue[count] = value;
				puddle_Left[count] = LeftWall[depth];
				for(int u = 1; u < 5;){
					if(count == 0){
						u = 10;
					}else if(puddle_Left[count - 1] > LeftWall[depth]){
						puddle_Left[count - 1] = LeftWall[depth];
						puddlevalue[count - 1] += puddlevalue[count];
						count--;
					}else{
						u = 10;
					}
				}
//				printf(" %d",value);
				depth--;
				count++;
			}
/*			printf("%d\t... ", i);
			for(int o = 0; o < count; o++){
				printf("%d(%d) ",puddlevalue[o],puddle_Left[o]);
			}
			printf("\n");*/
//			printf("\ndepth : %d\n",depth);
		}else{
//			printf("type3\n");
		}
//		printf("%d ",depth);
	}
	
	int puddletotal = 0;
	for(int i = 0; i < count; i++){
		puddletotal += puddlevalue[i];
	}
	printf("%d\n",puddletotal);
	printf("%d",count);
	for(int i = 0; i < count; i++){
		printf(" %d", puddlevalue[i]);
	}
	printf("\n");
	return 0;
}

