from typing import Generic, List, TypeVar

T = TypeVar('T')

class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container)


if __name__ == "__main__":
	stack1 = Stack()
	stack2 = Stack()
	string = input()
	sum = 0
	for i in range(len(string)):
		if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	print(sum)
	b = []
	while not stack2.empty:
		b.append(str(stack2.pop()[1]))
	b.append(str(len(b)))
	b.reverse()
	print(' '.join(b))
 from typing import Generic, List, TypeVar T = TypeVar('T') T TypeVar('T') TypeVar 'T' class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container) Stack def __init__(self) -> None:
		self._container: List[T] = []
					
	 __init__ self._container: List[T] = [] self._container self _container [] self self def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	 empty return not self._container not self._container self._container self _container self self @property
	 empty property empty def push(self, item: T) -> None:
		self._container.append(item)

	 push self._container.append(item) self._container.append self._container self _container append item self self item: T item def pop(self) -> T:
		return self._container.pop() # LIFO
	
	 pop return self._container.pop() self._container.pop() self._container.pop self._container self _container pop self self def __repr__(self) -> str:
		return repr(self._container) __repr__ return repr(self._container) repr(self._container) repr self._container self _container self self Generic[T] Generic T if __name__ == "__main__":
	stack1 = Stack()
	stack2 = Stack()
	string = input()
	sum = 0
	for i in range(len(string)):
		if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	print(sum)
	b = []
	while not stack2.empty:
		b.append(str(stack2.pop()[1]))
	b.append(str(len(b)))
	b.reverse()
	print(' '.join(b)) __name__ == "__main__" __name__ "__main__" stack1 = Stack() stack1 Stack() Stack stack2 = Stack() stack2 Stack() Stack string = input() string input() input sum = 0 sum 0 for i in range(len(string)):
		if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	 i range(len(string)) range len(string) len string if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	 string[i] == "\\" string[i] string i "\\" stack1.push(i) stack1.push stack1 push i elif string[i] == "_":
			pass
		 string[i] == "_" string[i] string i "_" elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	 string[i] == "/" string[i] string i "/" if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	 not stack1.empty stack1.empty stack1 empty j = stack1.pop() j stack1.pop() stack1.pop stack1 pop sum += i - j sum i - j i j a = i - j a i - j i j while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				 not stack2.empty stack2.empty stack2 empty item = stack2.pop() item stack2.pop() stack2.pop stack2 pop if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				 item[0] <= j item[0] item 0 j stack2.push(item) stack2.push stack2 push item break a += item[1] a item[1] item 1 stack2.push((j, a)) stack2.push stack2 push (j, a) j a print(sum) print sum b = [] b [] while not stack2.empty:
		b.append(str(stack2.pop()[1]))
	 not stack2.empty stack2.empty stack2 empty b.append(str(stack2.pop()[1])) b.append b append str(stack2.pop()[1]) str stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 b.append(str(len(b))) b.append b append str(len(b)) str len(b) len b b.reverse() b.reverse b reverse print(' '.join(b)) print ' '.join(b) ' '.join ' ' join b sum = 0 0 sum class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container) class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container) Stack stack2 = Stack() Stack() stack2 a += item[1] item[1] a a = i - j i - j a j = stack1.pop() stack1.pop() j item = stack2.pop() stack2.pop() item string = input() input() string T = TypeVar('T') TypeVar('T') T stack1 = Stack() Stack() stack1 b = [] [] b sum += i - j i - j sum
from typing import Generic, List, TypeVar

T = TypeVar('T')

class Stack(Generic[T]):
	def __init__(self) -> None:
		self._container: List[T] = []
					
	@property
	def empty(self) -> bool:
		return not self._container # コンテナが空ならば真となる
	
	def push(self, item: T) -> None:
		self._container.append(item)

	def pop(self) -> T:
		return self._container.pop() # LIFO
	
	def __repr__(self) -> str:
		return repr(self._container)


if __name__ == "__main__":
	stack1 = Stack()
	stack2 = Stack()
	string = input()
	sum = 0
	for i in range(len(string)):
		if string[i] == "\\":
			stack1.push(i)
		elif string[i] == "_":
			pass
		elif string[i] == "/":
			if not stack1.empty:
				j = stack1.pop()
				sum += i - j
				a = i - j
				while not stack2.empty:
					item = stack2.pop()
					if item[0] <= j:
						stack2.push(item)
						break
					else:
						a += item[1]
				stack2.push((j, a))
	print(sum)
	b = []
	while not stack2.empty:
		b.append(str(stack2.pop()[1]))
	b.append(str(len(b)))
	b.reverse()
	print(' '.join(b))

