Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequence so complex that no matter how hard he tries, he will not be able to remove a simple subsequence!

We say that a string formed by $n$ characters '(' or ')' is simple if its length $n$ is even and positive, its first $\frac{n}{2}$ characters are '(', and its last $\frac{n}{2}$ characters are ')'. For example, the strings () and (()) are simple, while the strings )( and ()() are not simple.

Kuroni will be given a string formed by characters '(' and ')' (the given string is not necessarily simple). An operation consists of choosing a subsequence of the characters of the string that forms a simple string and removing all the characters of this subsequence from the string. Note that this subsequence doesn't have to be continuous. For example, he can apply the operation to the string ')()(()))', to choose a subsequence of bold characters, as it forms a simple string '(())', delete these bold characters from the string and to get '))()'. 

Kuroni has to perform the minimum possible number of operations on the string, in such a way that no more operations can be performed on the remaining string. The resulting string does not have to be empty.

Since the given string is too large, Kuroni is unable to figure out how to minimize the number of operations. Can you help him do it instead?

A sequence of characters $a$ is a subsequence of a string $b$ if $a$ can be obtained from $b$ by deletion of several (possibly, zero or all) characters.


-----Input-----

The only line of input contains a string $s$ ($1 \le |s| \le 1000$) formed by characters '(' and ')', where $|s|$ is the length of $s$.


-----Output-----

In the first line, print an integer $k$  — the minimum number of operations you have to apply. Then, print $2k$ lines describing the operations in the following format:

For each operation, print a line containing an integer $m$  — the number of characters in the subsequence you will remove.

Then, print a line containing $m$ integers $1 \le a_1 < a_2 < \dots < a_m$  — the indices of the characters you will remove. All integers must be less than or equal to the length of the current string, and the corresponding subsequence must form a simple string.

If there are multiple valid sequences of operations with the smallest $k$, you may print any of them.


-----Examples-----
Input
(()((

Output
1
2
1 3 

Input
)(

Output
0

Input
(()())

Output
1
4
1 2 5 6 



-----Note-----

In the first sample, the string is '(()(('. The operation described corresponds to deleting the bolded subsequence. The resulting string is '(((', and no more operations can be performed on it. Another valid answer is choosing indices $2$ and $3$, which results in the same final string.

In the second sample, it is already impossible to perform any operations.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

String algorithms

Amortized analysis

Constructive algorithms


Solutions:
import sys
s = input()
j = len(s)
n = len(s)
ans = []
for i in range(n):
	if i >= j:
		break
	if s[i] == '(':
		while True:
			j -= 1
			if i >= j:
				break
			if s[j] == ')':
				ans.append(i)
				ans.append(j)
				break
if len(ans) == 0:
	print(0)
	sys.exit()
else:
	print(1)
print(len(ans))
ans = [ans[i] + 1 for i in range(len(ans))]
ans.sort()
print(*ans)


a = input().strip()
ans = []
l = 0
r = len(a) - 1
while l < r:
	if a[l] != '(':
		l += 1
		continue
	if a[r] != ')':
		r -= 1
		continue
	ans.append(l + 1)
	ans.append(r + 1)
	l += 1
	r -= 1
if ans:
	print(1)
	print(len(ans))
	ans.sort()
	print(' '.join(map(str, ans)))
else:
	print(0)


s = input()
n = len(s)
(a, b) = ([], [])
for i in range(n):
	if s[i] == '(':
		a.append(i)
	if s[i] == ')':
		b.append(i)
ans = []
(cnt_a, cnt_b) = (0, len(b) - 1)
while cnt_a < len(a) and cnt_b >= 0:
	if a[cnt_a] > b[cnt_b]:
		break
	ans.append(a[cnt_a])
	ans.append(b[cnt_b])
	cnt_a += 1
	cnt_b -= 1
ans.sort()
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(' '.join([str(i + 1) for i in ans]))


import sys
input = lambda : sys.stdin.readline().rstrip()
s = input()
mas = []
k = 1
for i in s:
	p = [i, k]
	mas.append(p)
	k += 1
(l, r) = (0, len(s) - 1)
ans = []
while True:
	if len(mas) == 0:
		break
	if mas[l][0] != '(':
		l += 1
	if mas[r][0] != ')':
		r -= 1
	if r == 0 or l == len(mas) or r <= l:
		break
	if mas[l][0] == '(' and mas[r][0] == ')':
		ans.append(mas[l][1])
		ans.append(mas[r][1])
		del mas[l]
		del mas[r - 1]
		r = len(mas) - 1
		l = 0
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*sorted(ans))


s = input()
n = len(s)
i = 0
j = n - 1
ans = []
while i < j:
	while i < n and s[i] != '(':
		i += 1
	while j > 0 and s[j] != ')':
		j -= 1
	if i < j:
		ans.extend([i + 1, j + 1])
	i += 1
	j -= 1
if ans:
	k = 1
else:
	k = 0
print(k)
for i in range(k):
	print(len(ans))
	print(*sorted(ans))


s = input()
ans = []
(first, last) = (0, len(s) - 1)
while True:
	while first < len(s) and s[first] == ')':
		first += 1
	while last >= 0 and s[last] == '(':
		last -= 1
	if first >= last:
		break
	ans.append(first + 1)
	first += 1
	ans.append(last + 1)
	last -= 1
if ans:
	print(1)
	print(len(ans))
	print(' '.join((str(i) for i in sorted(ans))))
else:
	print(0)


def main():
	from sys import stdin, stdout
	s = stdin.readline().strip()
	ans = []
	while True:
		temp = []
		l = 0
		r = len(s) - 1
		while l < r:
			if s[l] == '(' and s[r] == ')':
				temp.append(l)
				temp.append(r)
				l += 1
				r -= 1
			if s[l] == '(' and s[r] == '(':
				r -= 1
			if s[l] == ')':
				l += 1
		if len(temp) == 0:
			break
		temp.sort()
		ans.append(temp)
		tempS = ''
		j = 0
		for i in range(len(s)):
			if j < len(temp) and i == temp[j]:
				j += 1
				continue
			else:
				tempS += s[i]
		s = tempS
	stdout.write(str(len(ans)) + '\n')
	for i in ans:
		stdout.write(str(len(i)) + '\n')
		for j in i:
			stdout.write(str(j + 1) + ' ')
		stdout.write('\n')
main()


s = input()
finish = False
total_left = 0
total_right = 0
for char in s:
	if char == '(':
		total_left += 1
	else:
		total_right += 1
current_left = 0
current_right = 0
left_output = []
right_output = []
if len(list(filter(lambda x: x == '(', s))) == 0 or len(list(filter(lambda x: x == ')', s))) == 0:
	print(0)
else:
	for (i, char) in enumerate(s):
		if char == '(':
			current_left += 1
		else:
			current_right += 1
		left_mirror = total_right - current_right
		if current_left != 0 and current_left == left_mirror:
			for (idx, c) in enumerate(s[:i + 1]):
				if c == '(':
					left_output.append(idx + 1)
			for (idx, c) in enumerate(s[i + 1:]):
				if c == ')':
					right_output.append(i + 2 + idx)
			print(1)
			print(len(left_output) + len(right_output))
			print(' '.join((str(x) for x in left_output + right_output)))
			finish = True
	if not finish:
		print(0)


import sys
input = lambda : sys.stdin.readline()
s = list(input())
ind = len(s)
ans = []
for i in range(len(s)):
	if s[i] == '(':
		while ind > i:
			ind -= 1
			if s[ind] == ')':
				ans.append(i + 1)
				ans.append(ind + 1)
				break
if ans:
	print(1)
	print(len(ans))
	ans.sort()
	print(' '.join(map(str, ans)))
else:
	print(0)


from sys import stdin, stdout
input = stdin.readline
t = 1
for _ in range(t):
	s = input()[:-1]
	n = len(s)
	a = [0 for i in range(n)]
	b = [0 for i in range(n)]
	if s[0] == '(':
		a[0] = 1
	else:
		b[0] = 1
	for i in range(1, n):
		if s[i] == '(':
			a[i] = a[i - 1] + 1
			b[i] = b[i - 1]
		else:
			a[i] = a[i - 1]
			b[i] = b[i - 1] + 1
	sum = s.count(')')
	p = -1
	for i in range(n):
		if a[i] + b[i] == sum:
			p = i
			break
	if p == -1:
		print(0)
		continue
	vals = []
	for i in range(n):
		if i <= p and s[i] == '(':
			vals.append(i + 1)
		elif i > p and s[i] == ')':
			vals.append(i + 1)
	if len(vals):
		print(1)
		print(len(vals))
		print(*vals)
	else:
		print(0)


s = input()
(opens, closed) = ([], [])
indices = []
for (i, c) in enumerate(s):
	if c == '(':
		opens.append(i)
	else:
		closed.append(i)
(oPtr, cPtr) = (0, len(closed) - 1)
while oPtr < len(opens) and cPtr > -1:
	if opens[oPtr] > closed[cPtr]:
		break
	indices.append(opens[oPtr] + 1)
	indices.append(closed[cPtr] + 1)
	oPtr += 1
	cPtr -= 1
indices.sort()
if len(indices) > 0:
	print('1\n' + str(len(indices)) + '\n' + ' '.join(map(str, indices)))
else:
	print(0)


string = input()
(oList, cList) = ([], [])
for i in range(len(string)):
	if string[i] == '(':
		oList.append(i)
	if string[i] == ')':
		cList.append(i)
(oPtr, cPtr) = (0, len(cList) - 1)
removal = []
while oPtr < len(oList) and cPtr >= 0:
	if oList[oPtr] > cList[cPtr]:
		break
	removal.append(oList[oPtr])
	removal.append(cList[cPtr])
	oPtr += 1
	cPtr -= 1
removal.sort()
if len(removal) == 0:
	print(0)
else:
	print('1\n{}\n{}'.format(len(removal), ' '.join([str(x + 1) for x in removal])))


def main():
	s = input()
	moves = []
	while True:
		left = 0
		right = s.count(')')
		max_count = 0
		index = -1
		move = set()
		for i in range(len(s)):
			if s[i] == '(':
				left += 1
			else:
				right -= 1
			count = min(left, right)
			if count >= max_count:
				index = i
				max_count = count
		if max_count == 0:
			break
		for i in range(index + 1):
			if s[i] == '(':
				move.add(i + 1)
			if len(move) == max_count:
				break
		for i in range(index + 1, len(s)):
			if s[i] == ')':
				move.add(i + 1)
			if len(move) == 2 * max_count:
				break
		s1 = ''
		for i in range(len(s)):
			if i + 1 not in move:
				s1 += s[i]
		s = s1[:]
		move = list(move)
		move.sort()
		moves.append(move)
	print(len(moves))
	for m in moves:
		print(len(m))
		for i in m:
			print(i, end=' ')
		print()
main()


s = list(input())
d = 0
v1 = []
v2 = []
x1 = '('
x2 = ')'
i = 0
j = len(s) - 1
while i < j:
	if s[i] == x1 and s[j] == x2:
		d += 2
		v1.append(i + 1)
		v2.append(j + 1)
		(i, j) = (i + 1, j - 1)
	elif s[i] == x1 and s[j] != x2:
		j -= 1
	elif s[i] != x1 and s[j] == x2:
		i += 1
	else:
		i += 1
		j -= 1
if d == 0:
	print(0)
else:
	print(1)
	print(d)
	print(*v1, *reversed(v2))


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
s = read_line()
k = 0
ans = []
f = True
while f:
	i = 0
	j = len(s) - 1
	a = []
	while i < j:
		if s[i] == '(' and s[j] == ')':
			a.append(i + 1)
			a.append(j + 1)
			i += 1
			j -= 1
		elif s[i] == '(' and s[j] == '(':
			j -= 1
		elif s[i] == ')' and s[j] == '(':
			i += 1
			j -= 1
		elif s[i] == ')' and s[j] == ')':
			i += 1
	if len(a) == 0:
		f = False
	else:
		a.sort()
		ans.append(a)
		k += 1
		w = ''
		for i in range(len(s)):
			if i + 1 not in a:
				w = w + s[i]
		s = w
print(k)
for i in range(k):
	print(len(ans[i]))
	print(*ans[i])


s = input()
n = len(s)
l = 0
p = n - 1
le = [0] * n
pra = [0] * n
for i in range(1, n):
	if s[i - 1] == '(':
		le[i] = le[i - 1] + 1
	else:
		le[i] = le[i - 1]
for i in range(n - 1):
	j = n - 2 - i
	if s[j + 1] == ')':
		pra[j] = pra[j + 1] + 1
	else:
		pra[j] = pra[j + 1]
i = 0
while True:
	if le[i] < pra[i]:
		i += 1
	else:
		break
odp = []
if le[i] == pra[i]:
	for j in range(i):
		if s[j] == '(':
			odp.append(j + 1)
	for j in range(i + 1, n):
		if s[j] == ')':
			odp.append(j + 1)
	if len(odp) == 0:
		print(0)
	else:
		print(1)
		print(len(odp))
		print(*odp)
elif s[i] == ')':
	for j in range(i):
		if s[j] == '(':
			odp.append(j + 1)
	for j in range(i, n):
		if s[j] == ')':
			odp.append(j + 1)
	if len(odp) == 0:
		print(0)
	else:
		print(1)
		print(len(odp))
		print(*odp)
else:
	for j in range(i):
		if s[j] == '(':
			odp.append(j + 1)
	del odp[-1]
	for j in range(i + 1, n):
		if s[j] == ')':
			odp.append(j + 1)
	if len(odp) == 0:
		print(0)
	else:
		print(1)
		print(len(odp))
		print(*odp)


import sys
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_strList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
s = get_string()
matrix = []
while True:
	modified = False
	left = []
	right = []
	i = 0
	j = len(s) - 1
	turn = 0
	while i <= j:
		if turn == 0:
			if s[i] == '(':
				left.append(i)
				turn = 1
			i += 1
		else:
			if s[j] == ')':
				right.append(j)
				turn = 0
			j -= 1
	m = min(len(left), len(right))
	for i in range(m):
		s = s.replace('(', ' ')
		temp = s[::-1]
		temp = temp.replace(')', ' ')
		s = temp[::-1]
		modified = True
	if m > 0:
		left = left[:m]
		left = [left[i] + 1 for i in range(m)]
		right = right[:m]
		right = [right[i] + 1 for i in range(m)]
		matrix.append([left, right[::-1]])
	if not modified:
		break
if len(matrix) > 0:
	print(len(matrix))
	for i in range(len(matrix)):
		print(len(matrix[i][0]) + len(matrix[i][1]))
		print(*matrix[i][0], end=' ')
		print(*matrix[i][1])
else:
	print(0)


text = list(input())
a = len(text)
awn = []
for i in range(a):
	if text[i] == '(':
		for i1 in range(a - 1, i, -1):
			if text[i1] == ')':
				text[i] = '-'
				text[i1] = '-'
				awn.extend([i + 1, i1 + 1])
				break
if len(awn) != 0:
	print(1)
	print(len(awn))
	print(*sorted(awn))
else:
	print(0)


import sys
input = sys.stdin.readline
S = list(input().rstrip())
L = len(S)
l = 0
r = L - 1
ans = []
while l < r:
	while l < L and S[l] == ')':
		l += 1
	while r >= 0 and S[r] == '(':
		r -= 1
	if l < r:
		ans.append(l + 1)
		ans.append(r + 1)
		l += 1
		r -= 1
ans.sort()
if ans:
	print(1)
	print(len(ans))
	print(*ans)
else:
	print(0)


s = input()
i = 0
j = len(s) - 1
li = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		li.append(i + 1)
		li.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == ')':
		i += 1
	else:
		j -= 1
l_li = len(li)
if l_li == 0:
	print(0)
else:
	print(1)
	print(len(li))
	li.sort()
	print(*li, sep=' ')


s = input()
a = []
b = []
z = []
c = 0
for i in range(len(s)):
	if s[i] == '(':
		a.append(i)
	else:
		b.append(i)
		c = c + 1
i = j = l = 0
del s
if len(a) > 0:
	i = a[l]
if len(b) > 0:
	j = b[c - 1]
while i < j and len(a) != 0 and (len(b) != 0):
	z.append(a.pop(0) + 1)
	z.append(b.pop(c - 1) + 1)
	c = c - 1
	if len(a) == 0 or len(b) == 0:
		break
	j = b[c - 1]
	i = a[l]
if len(z) == 0:
	print('0')
else:
	print('1')
	print(len(z))
	z.sort()
	z = [str(x) for x in z]
	print(' '.join(z))


S = input()
Increasing = []
Decreasing = []
count = 0
for i in S:
	if i == '(':
		count += 1
		Increasing.append(count)
	else:
		Increasing.append(count)
count = 0
for i in S[::-1]:
	if i == ')':
		count += 1
		Decreasing.append(count)
	else:
		Decreasing.append(count)
Decreasing = Decreasing[::-1]
index = -1001
for i in range(len(Increasing) - 1):
	if Increasing[i] == Decreasing[i + 1] != 0:
		index = i
		break
if index != -1001:
	print(1)
	Ans = []
	for i in range(index + 1):
		if S[i] == '(':
			Ans.append(i + 1)
	for j in range(index + 1, len(Increasing)):
		if S[j] == ')':
			Ans.append(j + 1)
	print(len(Ans))
	print(*Ans)
else:
	print(0)


s = input()
i = 0
arr = []
while i < len(s):
	if s[i] == '(':
		arr.append(i)
	i += 1
i = len(s) - 1
arr1 = []
while i >= 0:
	if s[i] == ')':
		arr1.append(i)
	i -= 1
i = 0
j = 0
ans = []
while i < len(arr) and j < len(arr1):
	if arr[i] < arr1[j]:
		ans.append(arr[i] + 1)
		ans.append(arr1[i] + 1)
	else:
		break
	i += 1
	j += 1
if len(ans) == 0:
	print(0)
else:
	print(1)
	ans = sorted(ans)
	print(len(ans))
	print(*ans)


s = input()
n = len(s)
if s.count('(') == n or s.count(')') == n:
	print(0)
else:
	a = []
	b = []
	for i in range(n):
		if s[i] == '(':
			a.append(i)
		else:
			b.append(i)
	c = []
	i = 0
	j = len(b) - 1
	while i < len(a) and j >= 0:
		if a[i] > b[j]:
			break
		else:
			c.append(a[i] + 1)
			c.append(b[j] + 1)
			i += 1
			j -= 1
	if len(c) == 0:
		print(0)
	else:
		c.sort()
		print(1)
		print(len(c))
		for i in range(len(c)):
			print(c[i], end=' ')
		print()


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
s = input()
left = []
right = []
i = -1
j = len(s)
while True:
	i = s.find('(', i + 1)
	j = s.rfind(')', 0, j)
	if i < 0 or j < 0 or i > j:
		break
	left.append(i)
	right.append(j)
ans = left + right[::-1]
if not ans:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*(x + 1 for x in ans))


st = input()
left = [0] * len(st)
right = [0] * len(st)
cnt = 0
for i in range(len(st)):
	if st[i] == '(':
		cnt += 1
	left[i] = cnt
cnt = 0
for i in range(len(st) - 1, -1, -1):
	right[i] = cnt
	if st[i] == ')':
		cnt += 1
ans = -1
for i in range(len(st)):
	if min(left[i], right[i]) > ans:
		ans = min(left[i], right[i])
finans = []
tempans = ans
i = 0
while tempans > 0 and i < len(st):
	if st[i] == '(':
		finans.append(i)
		tempans -= 1
	i += 1
tempans = ans
i = len(st) - 1
tempfinans = []
while tempans > 0 and i >= 0:
	if st[i] == ')':
		tempfinans.append(i)
		tempans -= 1
	i -= 1
tempfinans = tempfinans[::-1]
finans = [i + 1 for i in finans]
for i in tempfinans:
	finans.append(i + 1)
if len(finans) > 0:
	print(1)
	print(len(finans))
	print(' '.join(map(str, finans)))
else:
	print(0)


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans

def simple(s, n):
	a = -1
	for i in range(n):
		if s[i] == '(':
			a = i
			break
	b = -1
	for i in range(a, n):
		if s[i] == ')':
			b = i
			break
	if a < b and a != -1:
		return False
	return True
s = input()
s = list(s)
n = len(s)
ans = []
while simple(s, n) == False:
	x = 0
	y = n - 1
	r = []
	while x < y:
		if s[x] == '(' and s[y] == ')':
			s[x] = -1
			s[y] = -1
			r.append(x + 1)
			r.append(y + 1)
			x += 1
			y -= 1
		if s[x] != '(':
			x += 1
		if s[y] != ')':
			y -= 1
	if r != []:
		r.sort()
		ans.append(r)
print(len(ans))
for i in range(len(ans)):
	print(len(ans[i]))
	print(*ans[i])


ss = input()
ans = []
k = 0
(s, e) = (0, len(ss) - 1)
while s < e:
	if ss[s] == '(' and ss[e] == ')':
		k += 1
		ans.append(s + 1)
		ans.append(e + 1)
		s += 1
		e -= 1
	if ss[s] == ')':
		s += 1
	if ss[e] == '(':
		e -= 1
if k > 0:
	print(1)
	print(k * 2)
	if k > 0:
		ans.sort()
		for i in ans:
			print(i, end=' ')
else:
	print(0)


s = str(input())
nr = list(range(1, len(s) + 1))
k = 0
t = s.find('(')
z = s.rfind(')')
pt1 = []
pt2 = []
while t != -1 and z != -1 and (z > t):
	k += 1
	pt1 = pt1 + [t + 1]
	pt2 = [z + 1] + pt2
	t = s.find('(', t + 1)
	z = s.rfind(')', 0, z)
if len(pt1) == 0:
	print(0)
else:
	print(1)
	print(2 * len(pt1))
	for i in range(len(pt1)):
		print(pt1[i], '', end='')
	for i in range(len(pt2)):
		print(pt2[i], '', end='')


s = input()
(lst1, lst2) = ([], [])
for i in range(len(s)):
	if s[i] == '(':
		lst1.append(i)
	if s[i] == ')':
		lst2.append(i)
(count1, count2, res) = (0, len(lst2) - 1, list())
while count1 < len(lst1) and count2 >= 0:
	if lst1[count1] > lst2[count2]:
		break
	res.append(lst1[count1])
	res.append(lst2[count2])
	count1 += 1
	count2 -= 1
res.sort()
print(0 if not res else '1\n{}\n{}'.format(len(res), ' '.join([str(x + 1) for x in res])))


s = str(input())
h = 0
t = len(s) - 1
visited = set()
left = list()
right = list()
while h < t:
	while h < t and s[h] != '(':
		h += 1
	while h < t and s[t] != ')':
		t -= 1
	if h in visited or t in visited:
		break
	if h < t:
		left.append(h)
		right.append(t)
		visited.add(h)
		visited.add(t)
		h += 1
		t -= 1
right.reverse()
left.extend(right)
if len(left) == 0:
	print(0)
	exit()
print(1)
print(len(left))
for i in range(len(left)):
	print(left[i] + 1, end=' ')


s = list(input())
l = len(s)
o = 0
ol = []
cl = []
c = l - 1
operations = 0
stop = False
ans = []
ol2 = []
cl2 = []
while True:
	af = False
	while o < l:
		if s[o] == '(':
			ol.append(o + 1)
			s[o] = '*'
			break
		o += 1
	o += 1
	while c >= 0:
		if s[c] == ')':
			cl.append(c + 1)
			s[c] = '*'
			break
		c -= 1
	c -= 1
	if o - 1 >= c + 1:
		if len(ol) > 0 and len(cl) > 0:
			for i in range(min(len(ol), len(cl))):
				if ol[i] < cl[i]:
					ol2.append(ol[i])
					cl2.append(cl[i])
			if len(ol2) == 0 or len(cl2) == 0:
				stop = True
			else:
				ans.append(ol2[:min(len(ol2), len(cl2))] + list(reversed(cl2[:min(len(ol2), len(cl2))])))
			ol.clear()
			cl.clear()
			ol2.clear()
			cl2.clear()
			o = 0
			c = l - 1
		else:
			stop = True
	if stop:
		break
print(len(ans))
for x in ans:
	print(len(x))
	print(*x)


s = input().rstrip()
sidx = list(zip(range(1, len(s) + 1), s))
result = []
while True:
	cnt_cl = [0] * len(sidx)
	cnt = 0
	for i in reversed(range(0, len(sidx))):
		cnt_cl[i] = cnt
		if sidx[i][1] == ')':
			cnt += 1
	new_sidx = []
	rm_idx = []
	rm_op = 0
	rm_cl = 0
	for i in range(0, len(sidx)):
		if rm_op < cnt_cl[i]:
			if sidx[i][1] == '(':
				rm_idx.append(sidx[i][0])
				rm_op += 1
		else:
			break
	for i in reversed(range(0, len(sidx))):
		if rm_cl < rm_op:
			if sidx[i][1] == ')':
				rm_idx.append(sidx[i][0])
				rm_cl += 1
		else:
			break
	for i in range(0, len(sidx)):
		if sidx[i][0] not in rm_idx:
			new_sidx.append(sidx[i])
	if len(rm_idx) == 0:
		break
	result.append(sorted(rm_idx))
	sidx = new_sidx
print(len(result))
for rm_idx in result:
	print(len(rm_idx))
	print(' '.join(map(str, rm_idx)))


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
s = input()
(a, b) = ([], [])
for i in range(len(s)):
	if s[i] == '(':
		a.append(i)
	else:
		b.append(i)
(i, j) = (0, len(b) - 1)
op = []
while i < len(a) and j >= 0:
	if a[i] < b[j]:
		op.append(a[i] + 1)
		op.append(b[j] + 1)
		i += 1
		j -= 1
	else:
		break
op.sort()
if op:
	print(1)
	print(len(op))
	print(*op)
else:
	print(0)


s = input()
a = []
b = []
l = 1
for i in s:
	if i == '(':
		a.append(l)
	else:
		b.append(l)
	l += 1
k = 0
j = len(b) - 1
ans = []
count = 0
while j >= 0 and k < len(a) and (a[k] < b[j]):
	ans.append(a[k])
	ans.append(b[j])
	k += 1
	j -= 1
	count += 1
if len(ans) > 0:
	ans.sort()
if count > 0:
	print('1')
	print(len(ans))
	for p in ans:
		print(p, end=' ')
else:
	print('0')


def ab(s):
	a = []
	b = []
	(i, j) = (0, len(s) - 1)
	c = 0
	while i < j:
		if c == 0:
			while i < j:
				if s[i] == '(':
					c = 1
					break
				i += 1
		else:
			while j > i:
				if s[j] == ')':
					c = 0
					a.append(i)
					i += 1
					b.append(j)
					j -= 1
					break
				j -= 1
	return a + b[::-1]
s = input()
z = []
a = ab(s)
if len(a) > 0:
	print(1)
	print(len(a))
	[print(i + 1, end=' ') for i in a]
else:
	print(0)


s = input()
del1 = []
del2 = []
for i in range(len(s)):
	if s[i] == '(':
		del1.append(i + 1)
for i in range(len(s) - 1, -1, -1):
	if s[i] == ')':
		del2.append(i + 1)
m_i = len(del1) + len(del2)
for i in range(min(len(del1), len(del2))):
	if del1[i] > del2[i]:
		m_i = i
		break
m = min(min(len(del1), len(del2)), m_i)
delete = del1[:m] + del2[:m]
delete.sort()
if m != 0:
	print(1)
	print(m * 2)
	print(*delete)
else:
	print(0)


s = input()
a = []
b = []
for (i, x) in enumerate(s):
	i += 1
	if x == '(':
		a.append(i)
	else:
		b.append(i)
A = []
B = []
i = 0
j = len(b) - 1
while i < len(a) and j >= 0 and (a[i] < b[j]):
	A.append(a[i])
	B.append(b[j])
	i += 1
	j -= 1
A += B[::-1]
if len(A) == 0:
	print(0)
else:
	print(1)
	print(len(A))
	print(' '.join([str(x) for x in A]))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_le(a, x):
	i = bi.bisect_right(a, x)
	if i:
		return i - 1
	else:
		return -1

def main():
	try:
		l = input()
		i = 0
		j = len(l) - 1
		ans = []
		while i < j:
			if l[i] == '(' and l[j] != ')':
				j -= 1
			elif l[i] == '(' and l[j] == ')':
				ans.append(i + 1)
				ans.append(j + 1)
				i += 1
				j -= 1
			else:
				i += 1
		if len(ans) == 0:
			print(0)
		else:
			print(1)
			print(len(ans))
			ans.sort()
			print(*ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


string = input()
(i, j) = (0, len(string) - 1)
index_l = []
index_r = []
while i < j:
	yes = False
	while i < j and string[i] != '(':
		i += 1
	if i < j:
		index_l.append(i + 1)
		i += 1
		yes = True
	while j >= i and string[j] != ')':
		j -= 1
	if j >= i and yes:
		index_r.append(j + 1)
		j -= 1
	elif yes:
		index_l.pop(-1)
if len(index_l) + len(index_r) == 0 or len(index_l) == 0 or len(index_r) == 0:
	print(0)
else:
	print(1)
	print(len(index_l) + len(index_r))
	print(*index_l + index_r[::-1])


s = input()
st = set()
left = 0
right = len(s) - 1
while True:
	while left < right and s[left] != '(':
		left += 1
	while left < right and s[right] != ')':
		right -= 1
	if left >= right:
		break
	else:
		st.add(left)
		st.add(right)
		left += 1
		right -= 1
if len(st) > 0:
	print(1)
	print(len(st))
	for v in sorted(st):
		print(v + 1, end=' ')
else:
	print(0)


s = str(input())
n = len(s)
l = [0] * n
r = [0] * n
for i in range(n):
	if s[i] == '(':
		l[i] = 1
for i in range(n):
	if s[i] == ')':
		r[i] = 1
r = list(reversed(r))
lc = [0] + l
rc = [0] + r
from itertools import accumulate
lc = list(accumulate(lc))
rc = list(accumulate(rc))
rc = list(reversed(rc))
for i in range(n):
	if lc[i] <= rc[i]:
		temp = lc[i]
if temp >= 1:
	print(1)
else:
	print(0)
	exit()
print(temp * 2)
i = 0
anss = []
temp_ = temp
while temp_:
	if l[i] == 1:
		anss.append(i + 1)
		temp_ -= 1
	i += 1
j = 0
temp_ = temp
r = list(reversed(r))
while temp_:
	if r[n - 1 - j] == 1:
		anss.append(n - j)
		temp_ -= 1
	j += 1
anss.sort()
print(*anss)


s = input()
l = list(s)
res = []
out = []
for (i, item) in enumerate(l):
	if item == '(':
		res.append(i + 1)
flag = 0
for i in range(len(s) - 1, -1, -1):
	if l[i] == '(' and res:
		del res[-1]
	if l[i] == ')':
		if res and res[0] - 1 < i:
			out.append(i + 1)
			out.append(res[0])
			del res[0]
			flag = 1
if out:
	print(1)
	print(len(out))
	print(*sorted(out), sep=' ')
else:
	print(0)


n = input()
i = 0
j = len(n) - 1
z = []
while i < j:
	if n[i] == '(' and n[j] == ')':
		z += [[i + 1, j + 1]]
		i += 1
		j -= 1
	elif n[i] == ')':
		i += 1
	elif n[j] == '(':
		j -= 1
print(1 if len(z) else 0)
if z:
	print(2 * len(z))
for i in z:
	print(i[0], end=' ')
for i in z[::-1]:
	print(i[-1], end=' ')


def f():
	s = input()
	n = len(s)
	memo0 = [0] * n
	memo1 = [0] * n
	cur = 0
	for i in range(n):
		if s[i] == '(':
			cur += 1
		memo0[i] = cur
	cur = 0
	for i in range(n - 1, -1, -1):
		if s[i] == ')':
			cur += 1
		memo1[i] = cur
	memo1.append(0)
	memo0 = [0] + memo0
	for i in range(n + 1):
		if memo0[i] == memo1[i]:
			bar = i
			break
	count = memo0[bar] * 2
	if count == 0:
		print(0)
		return
	posi = []
	for i in range(bar):
		if s[i] == '(':
			posi.append(i)
	for i in range(bar, n):
		if s[i] == ')':
			posi.append(i)
	print(1)
	print(count)
	print(' '.join((str(num + 1) for num in posi)))
f()


s = input()
le = len(s)
i = 0
j = le - 1
ans = []
while i < j:
	while s[i] == ')' and i < j:
		i = i + 1
	while s[j] == '(' and i < j:
		j = j - 1
	if i < j:
		ans.append(i)
		ans.append(j)
		i = i + 1
		j = j - 1
ans.sort()
if len(ans) > 0:
	print(1)
	print(len(ans))
	for i in range(len(ans)):
		if i == len(ans) - 1:
			print(ans[i] + 1)
		else:
			print(ans[i] + 1, end=' ')
else:
	print(0)


s = list(input())
n = len(s)
idx = []
r = n - 1
m = 0
for l in range(n):
	if s[l] == '(':
		for t in range(r, l, -1):
			if s[t] == ')':
				idx.append(l + 1)
				s[l] = '_'
				idx.append(t + 1)
				s[t] = '_'
				r -= 1
				m += 2
				break
if idx:
	print(1)
	print(m)
	idx.sort()
	print(*idx)
else:
	print(0)


s = input()
n = len(s)
out = []
left = []
right = []
for i in range(n):
	if s[i] == '(':
		left.append(i)
	else:
		right.append(i)
left.reverse()
while left and right and (left[-1] < right[-1]):
	out.append(left.pop())
	out.append(right.pop())
if out:
	print(1)
	print(len(out))
	print(' '.join([str(x + 1) for x in sorted(out)]))
else:
	print(0)


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P
from bisect import bisect_left as BL, bisect_right as BR
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write

def player1():
	print('')

def player2():
	print('')

def isPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def checkPath(source, destination, g):
	visited = [0] * 101
	q = Q()
	q.append(source)
	visited[source] = 1
	while q:
		node = q.popleft()
		if node == destination:
			return 1
		for v in g[node]:
			if not visited[v]:
				q.append(v)
				visited[v] = 1
	return 0

def main():
	s = INPUT()
	n = len(s)
	prefix = [0] * n
	suffix = [0] * len(s)
	if s[0] == '(':
		prefix[0] = 1
	if s[-1] == ')':
		suffix[n - 1] = 1
	for i in range(1, len(s)):
		if s[i] == '(':
			prefix[i] = prefix[i - 1] + 1
		else:
			prefix[i] = prefix[i - 1]
	for i in range(n - 2, -1, -1):
		if s[i] == ')':
			suffix[i] = suffix[i + 1] + 1
		else:
			suffix[i] = suffix[i + 1]
	length = 0
	for i in range(n - 1):
		length = max(length, min(prefix[i], suffix[i + 1]))
	k = 1
	ans = []
	count = 0
	for i in range(n):
		if count == length:
			break
		if s[i] == '(':
			ans.append(i + 1)
			count += 1
	count = 0
	ans2 = []
	for j in range(n - 1, -1, -1):
		if count == length:
			break
		if s[j] == ')':
			ans2.append(j + 1)
			count += 1
	ans += ans2[::-1]
	if not length:
		PRINT(str(0))
	else:
		PRINT('%d\n%d\n' % (1, 2 * length))
		for v in ans:
			PRINT('%d ' % v)
main()


s = ')' + input() + '('
(i, j) = (0, len(s))
a = []
while i < j:
	i = s.find('(', i + 1)
	j = s.rfind(')', 0, j)
	a += (i, j)
a = a[:-2]
print(int(a > []), *(a and [len(a)] + sorted(a)))


s = input()
n = len(s)
i = 0
j = n - 1
b = []
c = []
p = 0
while i < j:
	if s[i] == '(' and s[j] == ')':
		b.append(i + 1)
		b.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == '(':
		j -= 1
	else:
		i += 1
if len(b) == 0:
	print(0)
else:
	print(1)
	print(len(b))
	b.sort()
	print(*b)


s = [i for i in input().strip()]
ans = 0
pair_index = set()
ans_list = []
while True:
	right_index = len(s) - 1
	pair_index = set()
	for i in range(len(s)):
		if i >= right_index:
			break
		if s[i] == '(':
			for j in range(right_index, i, -1):
				right_index = j - 1
				if j <= i:
					break
				if s[j] == ')':
					pair_index.add(i)
					pair_index.add(j)
					break
	if pair_index == set():
		break
	ans_list.append([str(i + 1) for i in range(len(s)) if i in pair_index])
	s = [s[i] for i in range(len(s)) if i not in pair_index]
if len(ans_list) == 0:
	print(0)
else:
	print(len(ans_list))
	for i in ans_list:
		print(len(i))
		print(' '.join(i))


s = input()
res = []
i = 0
j = len(s) - 1
while i < j:
	if s[i] == '(' and s[j] == ')':
		res.append(i + 1)
		res.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == ')':
		i += 1
	else:
		j -= 1
if len(res) == 0:
	print(0)
else:
	print(1)
	print(len(res))
	res.sort()
	print(*res, sep=' ')


import math
s = input()
l = 0
r = len(s) - 1
a = []
while r > l:
	if s[l] == '(':
		while r > l and s[r] != ')':
			r = r - 1
		if r > l:
			a.append(l)
			a.append(r)
			r = r - 1
	l = l + 1
a.sort()
if len(a) > 0:
	print(1)
	print(len(a))
	for i in range(0, len(a)):
		print(a[i] + 1, end=' ')
	print('')
else:
	print(0)


from sys import stdin
input = lambda : stdin.readline().strip()
from collections import deque as d
l = len
s = list(input())
i = 0
ans = []
j = l(s) - 1
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			ans.append(i + 1)
			ans.append(j + 1)
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
if ans:
	print(1)
	print(l(ans))
	print(*sorted(ans))
else:
	print(0)


x = list(input())
a = []
b = []
for i1 in range(len(x)):
	if x[i1] == '(':
		a.append(i1 + 1)
	else:
		b.append(i1 + 1)
b.reverse()
index = []
i = 0
while True:
	if i >= len(b) or i >= len(a):
		break
	if a[i] < b[i]:
		index.append(a[i])
		index.append(b[i])
	else:
		break
	i += 1
index.sort()
if len(index) == 0:
	print(0)
else:
	print(1)
	print(len(index))
	print(*index)


a = input()
l1 = []
l2 = []
for i in range(len(a)):
	if a[i] == '(':
		l1.append(int(i) + 1)
	else:
		l2.append(int(i) + 1)
a = len(l1)
b = len(l2)
if a == 0 or b == 0:
	print('0')
else:
	p = l1[0]
	q = l2[b - 1]
	k = 0
	t = b - 1
	c = 0
	while p <= q:
		c += 1
		if k == a - 1 or t == 0:
			break
		else:
			k += 1
			t -= 1
			p = l1[k]
			q = l2[t]
	if c == 0:
		print('0')
	else:
		print('1')
		print(2 * c)
		for i in range(c):
			print(l1[i], end=' ')
		for i in range(b - c, b):
			print(l2[i], end=' ')


str_ = input()
left_bracket_index_list = []
right_bracket_index_list = []
match_index_list = []
for i in range(0, len(str_)):
	if str_[i] == '(':
		left_bracket_index_list.append(i + 1)
	elif str_[i] == ')':
		right_bracket_index_list.append(i + 1)
right_bracket_index_list.sort(reverse=True)
if len(left_bracket_index_list) >= len(right_bracket_index_list):
	Lim = len(right_bracket_index_list)
else:
	Lim = len(left_bracket_index_list)
for i in range(0, Lim):
	if left_bracket_index_list[i] < right_bracket_index_list[i]:
		match_index_list.append(left_bracket_index_list[i])
		match_index_list.append(right_bracket_index_list[i])
	else:
		break
match_index_list.sort()
if len(match_index_list) > 0:
	print(1)
	print(len(match_index_list))
	for i in match_index_list:
		print(i, end=' ')
elif len(match_index_list) == 0:
	print(0)


import sys
input = sys.stdin.readline
S = list(input().strip())

def delst(S):
	LEN = len(S)
	R = [0] * (LEN + 1)
	L = [0] * (LEN + 1)
	for i in range(LEN):
		if S[i] == '(':
			R[i] = R[i - 1] + 1
		else:
			R[i] = R[i - 1]
	for i in range(LEN - 1, -1, -1):
		if S[i] == ')':
			L[i] = L[i + 1] + 1
		else:
			L[i] = L[i + 1]
	MAX = 0
	for i in range(LEN - 1):
		MAX = max(MAX, min(R[i], L[i + 1]))
	return MAX
ANS = []
while True:
	MAX = delst(S)
	if MAX == 0:
		break
	else:
		ANS.append(MAX * 2)
		R = []
		count = 0
		for i in range(len(S)):
			if S[i] == '(':
				R.append(i)
				count += 1
			if count == MAX:
				break
		L = []
		count = 0
		for i in range(len(S) - 1, -1, -1):
			if S[i] == ')':
				L.append(i)
				count += 1
			if count == MAX:
				break
		X = R + L[::-1]
		ANS.append(X)
		NS = []
		ind = 0
		X.append(-1)
		for i in range(len(S)):
			if i == X[ind]:
				ind += 1
				continue
			NS.append(S[i])
		S = NS
print(len(ANS) // 2)
for i in range(len(ANS) // 2):
	print(ANS[i * 2])
	X = ANS[i * 2 + 1][:-1]
	print(*[x + 1 for x in X])


s = input()
si = len(s)
i = 0
j = si - 1
res = []
ff = False
cu = 0
while i < j:
	if s[i] == '(' and s[j] == ')':
		res.append(i + 1)
		res.append(j + 1)
		i += 1
		j -= 1
		ff = True
		cu += 2
	elif s[i] == '(':
		j -= 1
	else:
		i += 1
if ff == False:
	print(0)
else:
	print(1)
	print(len(res))
	print(*sorted(res))


s = input()
n = len(s)
r = n
l = -1
cntl = 0
cntr = 0
st = []
while l < r:
	if cntl < cntr:
		l += 1
		if s[l] == '(':
			cntl += 1
			st.append(l + 1)
	else:
		r -= 1
		if s[r] == ')':
			cntr += 1
			st.append(r + 1)
if cntr != cntl:
	st.pop()
if len(st) == 0:
	print(0)
else:
	print(1)
	print(len(st))
	print(*sorted(st))


s = input()
good = []
bad = []
for i in range(len(s)):
	if s[i] == '(':
		good.append(i)
for j in range(len(s)):
	if s[j] == ')':
		bad.append(j)
sizes = []
steps = []
size = -1
for i in range(min(len(good), len(bad))):
	if good[i] > bad[len(bad) - 1 - i]:
		size = 2 * i
		break
if size == -1:
	size = 2 * min(len(good), len(bad))
ans = ''
for i in range(size // 2):
	ans += str(good[i] + 1) + ' '
for i in range(size // 2):
	ans += str(bad[len(bad) - size // 2 + i] + 1) + ' '
if size != 0:
	print(1)
print(size)
print(ans.rstrip())


import sys
input = sys.stdin.readline

def main():
	al = list(input())
	al.pop()
	n = len(al)
	ans = [False] * n
	ok = 0
	(i, j) = (0, n - 1)
	while i < j:
		while i < n and al[i] == ')':
			i += 1
		while j >= 0 and al[j] == '(':
			j -= 1
		if i < j and al[i] == '(' and (al[j] == ')'):
			ans[i] = ans[j] = True
			ok += 2
		i += 1
		j -= 1
	print(1 if ok != 0 else 0)
	if ok != 0:
		print(ok)
	for i in range(n):
		if ans[i] == True:
			print(i + 1, end=' ')
main()


s = input()
(i, j) = (0, len(s) - 1)
ans = []
while i < j:
	while i < j and s[i] != '(':
		i += 1
	while i < j and s[j] != ')':
		j -= 1
	if i < j:
		ans.append(i + 1)
		ans.append(j + 1)
		i += 1
		j -= 1
ans.sort()
if ans:
	print(1)
	print(len(ans))
	print(*ans)
else:
	print(0)


s = input()
lst = []
(i, j) = (0, len(s) - 1)
while i < j:
	while i < len(s) and s[i] != '(':
		i += 1
	while j > -1 and s[j] != ')':
		j -= 1
	if i < j:
		lst.append(i + 1)
		lst.append(j + 1)
		i += 1
		j -= 1
if len(lst):
	print(1)
	print(len(lst))
	print(*sorted(lst))
else:
	print(0)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
seq = input()
n = len(seq)
leftbra = []
rightbra = []
for i in range(n):
	if seq[i] == '(':
		leftbra.append(i)
	else:
		rightbra.append(i)
rightbra.sort(reverse=True)
(lena, lenb) = (len(leftbra), len(rightbra))
endres = min(lena, lenb)
res = []
for i in range(endres):
	if leftbra[i] < rightbra[i]:
		res.append(leftbra[i])
		res.append(rightbra[i])
res.sort()
if len(res) == 0:
	print(0)
else:
	print(1)
	print(len(res))
	print(' '.join((str(x + 1) for x in res)))


s = input()
(l1, l2) = ([], [])
for i in range(len(s)):
	if s[i] == '(':
		l1.append(i)
	else:
		l2.append(i)
l2 = l2[::-1]
ans = []
for i in range(len(l1)):
	if len(l2) > 0 and l1[i] < l2[0]:
		ans.append(l1[i] + 1)
		ans.append(l2[0] + 1)
		del l2[0]
	else:
		break
ans.sort()
if len(ans) > 0:
	print(1)
	print(len(ans))
	print(*ans)
else:
	print(0)


s = list(input())
ans = []
i = 0
j = len(s) - 1
flag = 1
while flag:
	if i >= j:
		flag = 0
		break
	if s[i] == ')':
		i += 1
	elif s[i] == '(' and s[j] == ')':
		ans.append(i + 1)
		ans.append(j + 1)
		i += 1
		j -= 1
	else:
		j -= 1
if len(ans) == 0:
	print(0)
else:
	ans.sort()
	print(1)
	print(len(ans))
	print(*ans)


s = input()
res = []
(i, j) = (0, len(s) - 1)
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			res.extend([i + 1, j + 1])
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
if res:
	print(1)
	print(len(res))
	res.sort()
	print(*res)
else:
	print(0)


import sys
input = sys.stdin.readline
s = input().strip()
ans = []
while True:
	n = len(s)
	(lcnt, rcnt) = ([0] * n, [0] * n)
	for i in range(n):
		lcnt[i] = (1 if s[i] == '(' else 0) + (0 if i == 0 else lcnt[i - 1])
	for i in range(n - 1, -1, -1):
		rcnt[i] = (1 if s[i] == ')' else 0) + (0 if i == n - 1 else rcnt[i + 1])
	mx = 0
	for i in range(n):
		cur = min(lcnt[i], rcnt[i])
		mx = max(mx, cur)
	if mx == 0:
		break
	rem = []
	for i in range(n):
		if s[i] == '(':
			rem.append(i)
		if len(rem) == mx:
			break
	for i in range(n - 1, -1, -1):
		if s[i] == ')':
			rem.append(i)
		if len(rem) == mx * 2:
			break
	rem.sort()
	ans.append([i + 1 for i in rem])
	ns = [s[i] for i in sorted(set(range(n)) - set(rem))]
	s = ''.join(map(str, ns))
print(len(ans))
for rem in ans:
	print(len(rem))
	print(*rem)


import os
import sys
from io import BytesIO, IOBase

def main():
	s = input()
	n = len(s)
	open = []
	close = []
	ans = []
	open_cnt = 0
	close_cnt = 0
	pairs = 0
	for i in range(n):
		if s[i] == '(':
			open_cnt += 1
			open.append(i + 1)
		else:
			close_cnt += 1
			close.append(i + 1)
	close = close[::-1]
	for i in range(min(len(open), len(close))):
		if open[i] < close[i]:
			pairs += 1
			ans.append(open[i])
			ans.append(close[i])
	if pairs > 0:
		print(1)
		print(pairs * 2)
		print(*sorted(ans))
	else:
		print(0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import bisect
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(var)

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
s = data()
n = len(s)
(op, cl) = ([], [])
one = s.count('(')
zero = n - one
for i in range(n):
	if s[i] == '(':
		op.append(i)
	else:
		cl.append(i)
pairs = list()
(i, j) = (0, zero - 1)
while i < one and j >= 0:
	if op[i] < cl[j]:
		pairs.append(op[i] + 1)
		pairs.append(cl[j] + 1)
		i += 1
		j -= 1
	else:
		break
pairs.sort()
if len(pairs) > 0:
	out('1\n')
out(str(len(pairs)) + '\n')
if len(pairs) > 0:
	print(*pairs)


s = input()
oplist = []
cllist = []
for i in range(len(s)):
	if s[i] == '(':
		oplist.append(i)
	if s[i] == ')':
		cllist.append(i)
optr = 0
cptr = len(cllist) - 1
ans = 0
k = []
while optr < len(oplist) and cptr >= 0:
	if oplist[optr] > cllist[cptr]:
		break
	ans += 1
	k.append(oplist[optr] + 1)
	k.append(cllist[cptr] + 1)
	optr += 1
	cptr -= 1
if ans == 0:
	exit(print(0))
print(1)
print(len(k))
print(*sorted(k))


s = list(input())
n = len(s)
ans = []
l = 0
r = n - 1
while l < r:
	if s[l] == ')':
		l += 1
		continue
	if s[r] == '(':
		r -= 1
		continue
	if s[l] == '(' and s[r] == ')':
		ans.append(l + 1)
		ans.append(r + 1)
		l += 1
		r -= 1
		continue
	r -= 1
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	ans.sort()
	for i in ans:
		print(i, end=' ')
	print('')


string = input()
i = 0
j = len(string) - 1
ls = []
rs = []
while i < j:
	l = -1
	r = -1
	while i < j and string[i] != '(':
		i += 1
	l = i if string[i] == '(' else -1
	while i < j and string[j] != ')':
		j -= 1
	r = j if string[j] == ')' else -1
	if l != -1 and r != -1:
		ls.append(l + 1)
		rs.append(r + 1)
		i += 1
		j -= 1
if len(ls) == 0:
	print(0)
else:
	print(1)
	print(2 * len(ls))
	print(*ls, end=' ')
	print(*rs[::-1])


s = input()
op = []
cl = []
for (i, c) in enumerate(s):
	if c == '(':
		op.append(i)
	else:
		cl.append(i)
cl = cl[::-1]
(k, m) = (0, 0)
a = []
for (o, c) in zip(op, cl):
	if o < c:
		m += 2
		a.extend([o + 1, c + 1])
	else:
		break
if a:
	k = 1
	print(k)
	print(m)
	print(' '.join(map(str, sorted(a))))
else:
	print(0)


s = list(input())
done = False
count = 0
ans = []
l = 0
r = len(s) - 1
temp = []
while l < r:
	while s[l] != '(' and l < r:
		l += 1
	while s[r] != ')' and l < r:
		r -= 1
	if l < r:
		temp.append(l + 1)
		temp.append(r + 1)
		l += 1
		r -= 1
if not temp:
	print(0)
else:
	print(1)
	print(len(temp))
	print(*sorted(temp))


s = [i for i in input()]
opn = s.count('(')
cls = s.count(')')
(open_, close) = (0, 0)
ans = []
counter = 0
(ans1, ans2) = ([], [])
for i in range(len(s)):
	if s[i] == ')' and open_ != cls:
		cls -= 1
	if s[i] == '(' and open_ != cls:
		open_ += 1
		if open_ <= cls:
			ans2.append(i + 1)
	if open_ == cls:
		for j in range(i + 1, len(s)):
			ans1 = ans2
			if s[j] == ')':
				cls -= 1
				ans1.append(j + 1)
		open_ = 0
		break
if len(ans1) == 0:
	print(0)
else:
	print(1)
	print(len(ans1))
	print(*ans1)


s = input()
start = 0
end = len(s) - 1
x = []
while start < end and start < len(s) and (end >= 0):
	if s[start] == ')' and s[end] == ')':
		start += 1
	elif s[start] == '(' and s[end] == '(':
		end -= 1
	elif s[start] == '(' and s[end] == ')':
		x += [start + 1, end + 1]
		start += 1
		end -= 1
	else:
		start += 1
		end -= 1
if len(x) > 0:
	print(1)
	print(len(x))
	print(*sorted(x))
else:
	print(0)


string = input()
l_string = list(string)
l_inl = []
count = 0
l_char = []
while True:
	i = 0
	j = len(l_string) - 1
	count_of_char = 0
	l_index = []
	flag = 0
	while i < j:
		l = l_string[i]
		r = l_string[j]
		if l == '(' and r == ')':
			count_of_char += 2
			l_index.append(i)
			l_index.append(j)
			i += 1
			j -= 1
			flag = 1
		elif l == '(':
			j -= 1
		elif r == ')':
			i += 1
		else:
			i += 1
			j -= 1
	if flag == 1:
		flag = 0
		count += 1
		l_char.append(count_of_char)
		l_index.sort()
		iter = 0
		for k in l_index:
			l_string.pop(k - iter)
			iter += 1
		l_inl.append(l_index)
	else:
		break
print(count)
for i in range(len(l_char)):
	print(l_char[i])
	str_fin = ''
	for k in l_inl[i]:
		str_fin += str(k + 1) + ' '
	print(str_fin[:-1])


import sys
import math
input = sys.stdin.readline
s = input()
s1 = list()
for i in range(len(s)):
	if s[i] == ')' or s[i] == '(':
		s1.append(s[i])
up = list()
dwn = list()
for i in range(len(s1)):
	if s1[i] == '(':
		up.append(i)
	elif s1[i] == ')':
		dwn.append(i)
dwn.sort(reverse=True)
i = 0
j = 0
ans = list()
while i < len(up) and j < len(dwn):
	if up[i] > dwn[j]:
		break
	ans.append(up[i] + 1)
	ans.append(dwn[j] + 1)
	i += 1
	j += 1
if len(ans) > 0:
	print(1)
	print(len(ans))
	ans.sort()
	for i in range(len(ans)):
		print(ans[i], end=' ')
	print()
else:
	print(0)


test = list(input())
lbrac = []
rbarc = []
for i in range(len(test)):
	if test[i] == '(':
		lbrac.append(i + 1)
	else:
		rbarc.append(i + 1)
lf = []
rbarc.sort(reverse=True)
for _ in range(min(len(lbrac), len(rbarc))):
	if lbrac[0] < rbarc[0]:
		lf.append(lbrac.pop(0))
		lf.append(rbarc.pop(0))
	else:
		break
if len(lf) != 0:
	print(1)
print(len(lf))
lf.sort()
print(*lf, sep=' ')


string = list(input())
i = 0
j = len(string) - 1
anslist = []
startnotfound = 1
while i < j:
	if string[i] != '(':
		i += 1
		continue
	if string[j] != ')':
		j -= 1
		continue
	if string[i] == '(' and string[j] == ')':
		anslist.append(i + 1)
		anslist.append(j + 1)
		i += 1
		j -= 1
if anslist:
	print(1)
	print(len(anslist))
	anslist.sort()
	print(' '.join([str(i) for i in anslist]))
else:
	print(0)


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
s = si()
n = len(s)
x = []
y = []
i = 0
j = n - 1
(c1, c2) = (0, 0)
while i <= j:
	if c1 <= c2:
		if s[i] == '(':
			x.append(i + 1)
			c1 += 1
		i += 1
	if i <= j and c2 <= c1:
		if s[j] == ')':
			y.append(j + 1)
			c2 += 1
		j -= 1
if len(x) > len(y):
	x.pop()
if len(x) < len(y):
	y.pop()
x = x + y
if len(x) == 0:
	print('0')
else:
	print('1')
	print(len(x))
	x.sort()
	print(*x)


s = input()
n = len(s)
i = 0
j = n - 1
count = 0
combinations = 0
arr = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		count = count + 2
		combinations = 1
		arr.append(i + 1)
		arr.append(j + 1)
		i = i + 1
		j = j - 1
	elif s[i] == '(':
		j = j - 1
	elif s[j] == ')':
		i = i + 1
	else:
		i = i + 1
		j = j - 1
arr.sort()
if combinations == 0:
	print(0)
else:
	print(1)
	print(count)
	print(*arr, sep=' ')


def solve(s):
	track = []
	i = 0
	j = len(s) - 1
	while i < j:
		if s[i] == '(':
			if s[j] == '(':
				j -= 1
			else:
				track.append(i)
				track.append(j)
				i += 1
				j -= 1
		else:
			i += 1
	for i in range(len(track)):
		track[i] += 1
	track.sort()
	if len(track) == 0:
		print(0)
	else:
		print(1)
		print(len(track))
		print(' '.join(map(str, track)))
	return
s = input()
solve(s)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	s = sin()
	s = list(s)
	n = len(s)
	i = 0
	a = []
	c = []
	x = y = 0
	while 1:
		y = 0
		a = []
		x = 0
		for i in range(n):
			if s[i] == ')':
				x += 1
		i = 0
		while i < n:
			if s[i] == '(':
				a.append(i + 1)
				s[i] = 'p'
				y += 1
			elif s[i] == ')':
				x -= 1
			if y == x:
				i += 1
				while i < n:
					if s[i] == ')':
						a.append(i + 1)
						s[i] = 'p'
					i += 1
				if len(a) > 0:
					c.append(a)
				break
			i += 1
		if len(a) == 0:
			break
	print(len(c))
	for i in c:
		print(len(i))
		print(*i)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


s = input()
n = len(s)
count = 0
majorcount = 0
listi = []
listj = []
i = 0
j = n - 1
for k in range(n):
	if j > i:
		if s[i] == '(' and s[j] == ')':
			listi.append(i)
			listi.append(j)
			count += 1
			j = j - 1
			i += 1
		if s[i] == '(' and s[j] == '(':
			j = j - 1
		if s[i] == ')':
			i = i + 1
list2 = sorted(listi)
if count == 0:
	print(0)
else:
	print(1)
	print(len(list2))
	for i in list2:
		print(i + 1, end=' ')


s = input().rstrip()
f = []
b = []
for (i, v) in enumerate(s):
	if v == '(':
		f.append(i + 1)
	else:
		b.append(i + 1)
i = 0
a = []
while i < min(len(f), len(b)):
	if f[i] > b[-(i + 1)]:
		break
	a.append(f[i])
	a.append(b[-(i + 1)])
	i += 1
if a == []:
	print(0)
else:
	print(1)
	print(len(a))
	a.sort()
	print(*a)


a = input()
c = []
left = 0
right = len(a) - 1
while right > left:
	if a[left] == '(':
		while right > left:
			if a[right] == ')':
				c.append(right + 1)
				c.append(left + 1)
				left += 1
				right -= 1
				break
			right -= 1
	else:
		left += 1
c.sort()
if len(c) > 0:
	print(1)
	print(len(c))
	for i in range(len(c)):
		print(c[i], end=' ')
else:
	print(0)


from collections import *
(s, ans, arr) = (input(), 0, [])
d = deque([[i, s[i - 1]] for i in range(1, len(s) + 1)])
while True:
	tem1 = []
	while d:
		if d[0][1] == '(':
			while d:
				if d[-1][1] == ')':
					tem1.append(d[0][0])
					tem1.append(d[-1][0])
					d.pop()
					break
				d.pop()
			if d:
				d.popleft()
		else:
			d.popleft()
	if tem1:
		arr.append(tem1)
	else:
		break
print(len(arr))
for i in arr:
	print(len(i))
	print(*sorted(i))


s = input()
l = []
r = []
for i in range(len(s)):
	if s[i] == ')':
		l.append(i)
	else:
		r.append(i)
rp = 0
lp = len(l) - 1
removal = []
while rp < len(r) and lp >= 0:
	if r[rp] > l[lp]:
		break
	removal.append(r[rp])
	removal.append(l[lp])
	rp += 1
	lp -= 1
removal.sort()
if len(removal) == 0:
	print(0)
else:
	print('1\n{}\n{}'.format(len(removal), ' '.join([str(x + 1) for x in removal])))


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(10 ** 2)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def solution(s):
	n = len(s)
	s = [(s[i], i) for i in range(len(s))]
	cnt = 0
	sol = ['1', '\n']
	res = []
	i = 0
	while i < n and s[i][0] == ')':
		i += 1
	first = i
	i = n - 1
	while i > -1 and s[i][0] == '(':
		i -= 1
	last = i
	if last < first:
		return 0
	res_first = []
	res_last = []
	while first < last:
		if s[first][0] == '(' and s[last][0] == ')':
			res_first.append(first + 1)
			res_last.append(last + 1)
			first += 1
			last -= 1
			continue
		if s[first][0] == ')':
			first += 1
		if s[last][0] == '(':
			last -= 1
	res = res_first + list(reversed(res_last))
	sol += [str(len(res)), '\n']
	return ''.join(sol) + ' '.join(map(str, res))

def main():
	T = 1
	for i in range(T):
		s = rs()
		x = solution(s)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


s = input()
i = 0
j = len(s) - 1
counter = 0
answer_1 = []
answer_0 = []
while i < j:
	find_1 = False
	find_0 = False
	while i < j:
		if s[i] == '(':
			find_1 = True
			break
		i += 1
	while i < j:
		if s[j] == ')':
			find_0 = True
			break
		j -= 1
	if i >= j:
		break
	counter += 2
	answer_1.append(i + 1)
	answer_0.append(j + 1)
	i += 1
	j -= 1
answer_0.reverse()
if counter != 0:
	print('1')
print(counter)
for item in answer_1:
	print(item, end=' ')
for item in answer_0:
	print(item, end=' ')


s = input()
a0 = []
a1 = []
for i in range(len(s)):
	if s[i] == '(':
		a0.append(i)
	else:
		a1.append(i)
a1 = a1[::-1]
su = 1
a11 = []
a00 = []
while True:
	ans = []
	a11 = []
	a00 = []
	z = False
	for i in range(min(len(a1), len(a0))):
		if a1[i] > a0[i]:
			ans.append(a0[i] + 1)
			ans.append(a1[i] + 1)
			a11.append(i)
			a00.append(i)
			z = True
		else:
			break
	ac0 = []
	ac1 = []
	for i in range(len(a0)):
		if i not in a00:
			ac0.append(a0[i])
	a0 = ac0.copy()
	for i in range(len(a1)):
		if i not in a11:
			ac1.append(a1[i])
	a1 = ac1.copy()
	if z:
		print(su)
		print(len(ans))
		print(*sorted(ans))
		su += 1
	else:
		if su == 1:
			print(0)
		break


s = input()
n = len(s)
pre = [0 for i in range(n)]
if s[n - 1] == ')':
	pre[n - 1] = 1
for i in range(n - 2, -1, -1):
	if s[i] == ')':
		pre[i] = pre[i + 1] + 1
	else:
		pre[i] = pre[i + 1]
co = 0
aa = []
for i in range(n):
	if s[i] == '(':
		co += 1
		if pre[i] < co:
			co -= 1
			break
		else:
			aa.append(i + 1)
			ind = i
if aa == []:
	print(0)
else:
	print(1)
	print(len(aa) * 2)
	for i in range(n - 1, ind, -1):
		if co == 0:
			break
		if s[i] == ')':
			aa.append(i + 1)
			co -= 1
	aa.sort()
	print(*aa)


s = input()
left = 0
right = len(s) - 1
delt = []
while left < right:
	if s[left] == '(' and s[right] == ')':
		delt.append(left + 1)
		delt.append(right + 1)
		left += 1
		right -= 1
		continue
	if s[left] == ')':
		left += 1
	if s[right] == '(':
		right -= 1
if len(delt):
	print(1)
	print(len(delt))
	delt.sort()
	print(*delt)
else:
	print(0)


s = input()
l = []
r = []
for i in range(len(s)):
	if s[i] == '(':
		l.append(i)
	else:
		r.append(i)
i = 0
j = len(r) - 1
res = []
while i < len(l) and j >= 0:
	if l[i] > r[j]:
		break
	res.append(l[i] + 1)
	res.append(r[j] + 1)
	i += 1
	j -= 1
res.sort()
if len(res) == 0:
	print(0)
else:
	print(1)
	print(len(res))
	print(*res)


s = input()
n = len(s)
l = 0
r = n - 1
mas = []
while l < r:
	while s[l] != '(' and l < r:
		l += 1
	while s[r] != ')' and l < r:
		r -= 1
	if l < r:
		mas.append(l + 1)
		mas.append(r + 1)
		l += 1
		r -= 1
mas.sort()
if mas == []:
	print(0)
else:
	print(1)
	print(len(mas))
	print(*mas)


a = input()
l = len(a)
(op, cl) = ([], [])
res = []
p = 0
for i in range(l):
	if a[i] == '(':
		op.append(i + 1)
	else:
		cl.append(i + 1)
(i, j) = (0, 0)
x = len(cl)
while i < len(op) and j < len(cl):
	if op[i] < cl[x - j - 1]:
		res.extend([op[i], cl[x - j - 1]])
		p += 1
		i += 1
		j += 1
		continue
	if op[i] > cl[x - j - 1]:
		i += 1
	else:
		j += 1
if p == 0:
	print(0)
	exit(0)
print(1)
print(2 * p)
res.sort()
print(*res)


s = input()
solved = False
n = len(s)
(i1, i2) = (0, n - 1)
c = 0
finished = False
ind = []
while True:
	try:
		_i1 = s.index('(', i1, i2 + 1)
		_i2 = s.rindex(')', i1, i2 + 1)
	except ValueError:
		break
	if _i1 < _i2:
		ind.append(_i1 + 1)
		ind.append(_i2 + 1)
		c += 1
		i1 = _i1 + 1
		i2 = _i2 - 1
	else:
		break
if len(ind) == 0:
	print(0)
else:
	print(1)
	print(len(ind))
	print(*sorted(ind))


s = list(input())
moves = []

def reduce(s):
	p1 = 0
	p2 = len(s) - 1
	m = 0
	move = []
	while True:
		while p1 < len(s) and s[p1] != '(':
			p1 += 1
		while p2 >= 0 and s[p2] != ')':
			p2 -= 1
		if p1 >= p2:
			break
		m += 2
		move.append(p1 + 1)
		move.append(p2 + 1)
		s[p1] = None
		s[p2] = None
		p1 += 1
		p2 -= 1
	if m > 0:
		move.sort()
		moves.append(move)
		return True
	else:
		return False
while reduce(s):
	pass
print(len(moves))
for move in moves:
	print(len(move))
	print(*move)


word = list(input())
result = []
while True:
	i = 0
	j = len(word) - 1
	del_list = []
	check = 0
	while i <= j:
		if check == 0:
			if word[i] != '(':
				i += 1
			else:
				del_list.append(i + 1)
				check = 1
				i += 1
		elif word[j] != ')':
			j -= 1
		else:
			del_list.append(j + 1)
			check = 0
			j -= 1
	if len(del_list) % 2 != 0:
		del_list.pop()
	del_list.sort()
	cnt = 0
	for e in del_list:
		del word[e - 1 - cnt]
		cnt += 1
	if not del_list:
		break
	result.append(del_list)
print(len(result))
for i in range(len(result)):
	print(len(result[i]))
	for j in range(len(result[i])):
		print(result[i][j], end=' ')
	print()


s = input()
(l, r) = (len(s) - 1, 0)
a = []
b = []
while r < l:
	if s[r] == '(' and s[l] == ')':
		a.append(r + 1)
		b.append(l + 1)
		r += 1
		l -= 1
	elif s[r] == ')':
		r += 1
	elif s[l] == '(':
		l -= 1
r = min(len(a), len(b))
if r:
	print(1)
	print(r * 2)
	print(*a, *b[::-1])
else:
	print(0)


s = input()
open = [i for (i, x) in enumerate(s) if x == '(']
close = [i for (i, x) in enumerate(s) if x == ')']
open.reverse()
(ans_open, ans_close) = ([], [])
while open and close:
	if open[-1] < close[-1]:
		ans_open.append(open.pop())
		ans_close.append(close.pop())
	else:
		break
ans_close.reverse()
if ans_open:
	print(1)
	print(len(ans_open) * 2)
	print(' '.join((str(x + 1) for x in ans_open + ans_close)))
else:
	print(0)


from collections import deque

def ntvdm():
	s = input()
	op = deque()
	en = []
	for (i, c) in enumerate(s, 1):
		if c == '(':
			op.append(i)
		else:
			en.append(i)
	res = []
	while op and en:
		(a, b) = (op.popleft(), en.pop())
		if a < b:
			res += [a, b]
			continue
		break
	res.sort()
	if len(res):
		print(1)
		print(len(res))
		print(' '.join((str(e) for e in res)))
	else:
		print(0)
ntvdm()


s = input()
(l, r) = (0, len(s) - 1)
a = []
while l <= r:
	if s[l] == '(' and s[r] == ')':
		a.append(l + 1)
		a.append(r + 1)
		l += 1
		r -= 1
	elif s[l] == ')':
		l += 1
	else:
		r -= 1
if len(a) == 0:
	print(0)
else:
	print(1)
	print(len(a))
	a.sort()
	print(*a)


from collections import Counter
from collections import defaultdict
import math
s = list(input())
n = len(s)
ans = 0
q = 0
final = []
while ans != -1:
	ans = -1
	a1 = [0] * n
	a2 = [0] * n
	if s[0] == '(':
		a1[0] = 1
	if s[-1] == ')':
		a2[-1] = 1
	for i in range(1, n):
		if s[i] == '(':
			a1[i] = a1[i - 1] + 1
		else:
			a1[i] = a1[i - 1]
	for i in range(n - 2, -1, -1):
		if s[i] == ')':
			a2[i] = a2[i + 1] + 1
		else:
			a2[i] = a2[i + 1]
	ans = -1
	for i in range(0, n - 1):
		if a1[i] == a2[i + 1]:
			ans = i
			kitne = a1[i]
			break
	if ans == -1 or kitne == 0:
		break
	q = q + 1
	w = []
	for i in range(0, ans + 1):
		if s[i] == '(':
			s[i] = -1
			w.append(i + 1)
	for i in range(ans + 1, n):
		if s[i] == ')':
			s[i] = 1
			w.append(i + 1)
	final.append(w)
print(q)
for i in final:
	print(len(i))
	print(*i)


s = input()
k = 0
a = []
m = []
while True:
	a1 = []
	a2 = []
	pos1 = s.find('(')
	if pos1 == -1:
		pos1 = 1001
	pos2 = s.rfind(')')
	while pos1 < pos2:
		a1.append(pos1 + 1)
		a2.append(pos2 + 1)
		pos1 = s.find('(', pos1 + 1)
		pos2 = s[:pos2].rfind(')')
		if pos1 == -1:
			pos1 = 1001
	if a1 == [] or a2 == []:
		break
	k += 1
	a2 = sorted(a2)
	a1 += a2
	m1 = 0
	s = list(s)
	for i in a1:
		s[i - 1] = ''
		m1 += 1
	m.append(m1)
	a.append(a1)
	s = ''.join(s)
print(k)
for i in range(k):
	print(m[i])
	print(*a[i])


def siso(s):
	a = s.find('(')
	b = s.rfind(')')
	if a != -1 and b != -1 and (a < b):
		return True
	else:
		return False

def func1(s):
	count = 0
	tokenof = True
	while tokenof:
		mainstring = []
		l = list(s)
		start = 0
		end = len(s) - 1
		while start < end:
			if l[start] == '(' and l[end] == ')':
				mainstring = [str(start + 1)] + mainstring + [str(end + 1)]
				l[start] = ''
				l[end] = ''
				start += 1
				end -= 1
			elif l[start] == '(':
				end -= 1
			elif l[end] == ')':
				start += 1
			else:
				start += 1
				end -= 1
		if siso(s):
			count += 1
			mainstring.sort()
		else:
			tokenof = False
		s = ''.join(l)
	return count

def func(s):
	count = 0
	tokenof = True
	while tokenof:
		mainstring = []
		l = list(s)
		start = 0
		end = len(s) - 1
		leng = 0
		while start < end:
			if l[start] == '(' and l[end] == ')':
				mainstring = [start + 1] + mainstring + [end + 1]
				l[start] = ''
				l[end] = ''
				start += 1
				end -= 1
				leng += 2
			elif l[start] == '(':
				end -= 1
			elif l[end] == ')':
				start += 1
			else:
				start += 1
				end -= 1
		if siso(s) == False:
			tokenof = False
		else:
			count += 1
			mainstring.sort()
			print(leng)
			for i in mainstring:
				print(i, end=' ')
			print()
		s = ''.join(l)
s = input()
print(func1(s))
func(s)


s = input()
lens = len(s)
temp = str('(' * (lens // 2) + ')' * (lens // 2))
i = 0
j = lens - 1
a = []
while i <= j and i >= 0 and (j >= 0):
	if s[i] == '(':
		if s[j] != ')':
			j -= 1
		else:
			a.append(i + 1)
			a.append(j + 1)
			i += 1
			j -= 1
	else:
		i += 1
if len(a) > 0:
	print('1')
	print(len(a))
	for x in sorted(a):
		print(x, end=' ')
else:
	print('0')


s = input()
_open = []
close = []
a = []
for (index, letter) in enumerate(s):
	if letter == '(':
		_open.append(index)
	else:
		close.append(index)
result = []
while _open and close:
	if _open[0] < close[-1]:
		result.append(_open[0] + 1)
		del _open[0]
		result.append(close[-1] + 1)
		del close[-1]
	else:
		break
if result:
	print('1')
	print(len(result))
	result.sort()
	result = map(str, result)
	print(' '.join(result))
else:
	print('0')


def print_ar(a):
	for i in a:
		print(i, end=' ')
	print()

def main():
	s = input()
	(i, j) = (0, len(s) - 1)
	ans = []
	while i < j:
		while s[i] == ')' and i < j:
			i += 1
		while s[j] == '(' and j > i:
			j -= 1
		if s[i] == '(' and s[j] == ')':
			ans += [i + 1, j + 1]
		i += 1
		j -= 1
	if ans:
		print(1)
		print(len(ans))
		print_ar(sorted(ans))
	else:
		print(0)
main()


t = input()
l = []
for i in range(len(t)):
	if t[i] == '(':
		l.append(0)
	else:
		l.append(1)
ze = []
one = []
ans = []
z = 0
on = 0
for i in range(len(l)):
	if l[i] == 0:
		ze.append(i + 1)
		z += 1
	else:
		on += 1
		one.append(i + 1)
cc = 0
ans = []
while len(one) > 0 and len(ze) > 0 and (one[-1] > ze[0]):
	cc += 1
	ans.append(ze.pop(0))
	ans.append(one.pop())
if cc == 0:
	print(0)
	exit()
print(1)
print(2 * cc)
ans.sort()
print(*ans)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLS():
	return list(sys.stdin.readline().rstrip())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	s = RLS()
	(l, r) = (0, len(s) - 1)
	step = 0
	res = []
	while l < r:
		if s[l] == '(' and s[r] == ')':
			step += 2
			res.append(l + 1)
			res.append(r + 1)
			l += 1
			r -= 1
		elif s[l] == '(' and s[r] == '(':
			r -= 1
		elif s[l] == ')' and s[r] == ')':
			l += 1
		else:
			r -= 1
			l += 1
	res.sort()
	print(1 if step != 0 else 0)
	if step != 0:
		print(step)
		print(*res)
main()


def main():
	string = input()
	length = len(string)
	(a, b) = ([], [])
	for i in range(length):
		if string[i] == '(':
			a.append(i)
		else:
			b.append(i)
	removed_indices = []
	if len(a) > 0 and len(b) > 0:
		while not a[0] > b[-1]:
			removed_indices.append(a.pop(0) + 1)
			removed_indices.append(b.pop() + 1)
			if len(a) == 0 or len(b) == 0:
				break
	if len(removed_indices) == 0:
		print(0)
	else:
		print(1)
		print(len(removed_indices))
		print(*sorted(removed_indices))
main()


a = input()
c = []
b = []
i = 0
j = len(a) - 1
while i < j:
	if a[i] == '(':
		k = 0
		for k in range(j, i, -1):
			if a[k] == ')':
				b.append(i)
				c.append(k)
				break
		j = k - 1
	i = i + 1
if len(b) == 0 or len(c) == 0:
	print(0)
else:
	print(1)
	print(len(b) + len(c))
	for i in range(len(b)):
		print(b[i] + 1, end=' ')
	for i in range(len(c) - 1, -1, -1):
		print(c[i] + 1, end=' ')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(1):
	s = si()
	n = len(s)
	lt = [i + 1 for i in range(n) if s[i] == '(']
	rt = [i + 1 for i in range(n - 1, -1, -1) if s[i] == ')']
	nlt = len(lt)
	nrt = len(rt)
	(i, j) = (0, 0)
	ans = []
	while i < nlt and j < nrt:
		if lt[i] < rt[j]:
			ans.extend([lt[i], rt[j]])
			i += 1
			j += 1
		else:
			break
	if len(ans) > 0:
		print(1)
		print(len(ans))
		print(*sorted(ans))
	else:
		print(0)


import collections
s = list(input())
count = 0
q = collections.deque()
ans = []
l = 0
r = len(s) - 1
while 1:
	while s[l] != '(' and l < r:
		l += 1
	while s[r] != ')' and l < r:
		r -= 1
	if l < r:
		ans.append(l + 1)
		ans.append(r + 1)
		l += 1
		r -= 1
	else:
		break
if ans:
	print(1)
	print(len(ans))
	ans.sort()
	print(' '.join(map(str, ans)))
else:
	print(0)


s = input()
n = len(s)
ops = []
cls = []
for i in range(n):
	if s[i] == '(':
		ops.append(i)
	else:
		cls.append(i)
ops.reverse()
k = 0
ans = ''
while True:
	c = 0
	x1 = []
	x2 = []
	while ops and cls and (ops[-1] < cls[-1]):
		x1.append(str(ops.pop() + 1))
		x2.append(str(cls.pop() + 1))
		c += 1
	if c == 0:
		break
	x2.reverse()
	ans += str(c * 2) + '\n' + ' '.join(x1 + x2)
	k += 1
print(k)
print(ans)


def solve(seq):
	pointer1 = 0
	pointer2 = len(seq) - 1
	bold = 0
	ans = []
	while pointer1 < pointer2:
		if seq[pointer1] == '(' and seq[pointer2] == ')':
			bold += 2
			ans.append(pointer1 + 1)
			ans.append(pointer2 + 1)
			pointer1 += 1
			pointer2 -= 1
		elif seq[pointer1] == ')':
			pointer1 += 1
		elif seq[pointer2] == '(':
			pointer2 -= 1
	if bold == 0:
		print(0)
		return
	else:
		print(1)
		print(bold)
		for x in sorted(ans):
			print(x, end=' ')
solve(input())


s = input()
n = len(s)
left = []
right = []
re = []
for i in range(n):
	if s[i] == '(':
		left.append(i)
	else:
		right.append(i)
right.sort(reverse=True)
m = min(len(left), len(right))
for i in range(m):
	if left[i] < right[i]:
		re.append(left[i] + 1)
		re.append(right[i] + 1)
if len(re) == 0:
	print(0)
else:
	print(1)
	print(len(re))
	re.sort()
	print(*re)


s = input()
op = []
cl = []
ans = []
for i in range(len(s)):
	if s[i] == '(':
		op.append(i)
	else:
		cl.append(i)
op.reverse()
while op and cl and (op[-1] < cl[-1]):
	ans.append(op.pop(-1) + 1)
	ans.append(cl.pop(-1) + 1)
ans.sort()
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*ans)


s = input().rstrip()
x = list(s)
I = 0
J = len(x) - 1
M = 0
L = []
Q = []
while I <= J:
	if M % 2 == 0:
		if x[I] == '(':
			L.append(1 + I)
			I += 1
			M += 1
		else:
			I += 1
	elif x[J] == ')':
		Q.append(J + 1)
		M += 1
		J -= 1
	else:
		J -= 1
L.sort()
Q.sort()
if len(L) != len(Q):
	del L[len(L) - 1]
if len(L) == 0 and len(Q) == 0:
	print(0)
else:
	print(1)
	print(len(L) * 2)
	A = L + Q
	print(*A)


st = input()
lis = []
i = 0
j = len(st) - 1
while i < len(st):
	if st[i] == '(':
		while j >= 0 and j > i:
			if st[j] == ')':
				lis.append(i + 1)
				lis.append(j + 1)
				j -= 1
				break
			j -= 1
	i += 1
if len(lis) == 0:
	print(len(lis))
else:
	print('1')
	print(len(lis))
	lis.sort()
	print(*lis)


def solve(S):
	ops = []
	while True:
		l = 0
		r = len(S) - 1
		out = []
		while l < r:
			while l < len(S) and S[l] == ')':
				l += 1
			while r >= 0 and S[r] == '(':
				r -= 1
			if l < r:
				assert S[l] == '('
				assert S[r] == ')'
				out.append(l)
				out.append(r)
				l += 1
				r -= 1
		if not out:
			break
		out.sort()
		ops.append(str(len(out)) + '\n' + ' '.join((str(x + 1) for x in out)))
		out = set(out)
		temp = []
		for (i, c) in enumerate(S):
			if i not in out:
				temp.append(c)
		S = temp
	if not ops:
		return '0'
	return str(len(ops)) + '\n' + '\n'.join(ops)
S = input().rstrip()
ans = solve(S)
print(ans)


s = list(input().strip())
i = 0
j = len(s) - 1
ans = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		ans += [i + 1, j + 1]
		i += 1
		j -= 1
	elif s[i] == '(':
		j -= 1
	else:
		i += 1
if len(ans) > 0:
	print(1)
	print(len(ans))
	print(' '.join(map(str, sorted(ans))))
else:
	print(0)


word = input()
(l, r) = (0, len(word) - 1)
cnt = 0
f = 0
(a, b) = ([], [])
while l < r:
	if word[l] == '(' and word[r] == ')':
		a.append(l + 1)
		b.append(r + 1)
		l += 1
		r -= 1
	else:
		if word[l] != '(':
			l += 1
		if word[r] != ')':
			r -= 1
a.sort()
b.sort()
a = a + b
if a == []:
	print(0)
else:
	print(1)
	print(len(a))
	print(*a)


from sys import stdin, stdout
import bisect

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
l1 = input()
left = 0
right = len(l1) - 1
c = 0
b = False
l2 = []
while left < right:
	if l1[left] == '(':
		if l1[right] == ')':
			b = True
			c += 2
			l2.extend([left + 1, right + 1])
			left += 1
			right -= 1
		else:
			right -= 1
	else:
		left += 1
l2.sort()
if b:
	print(1)
print(c)
for i in l2:
	print(i, end=' ')


st = input()
op = []
cl = []
fin = []
for i in range(0, len(st)):
	if st[i] == '(':
		op.append(i)
	else:
		cl.append(i)
t = 1
rem = 0
ops = len(op)
cls = len(cl)
j = 0
i = 0
if ops == 0 or cls == 0:
	print(0)
elif op[0] > cl[cls - 1]:
	print(0)
else:
	while t:
		if rem + i > ops - 1 or cls - rem - 1 - j < 0:
			break
		if op[rem + i] < cl[cls - rem - 1 - j]:
			fin.append(op[rem + i] + 1)
			fin.append(cl[cls - rem - 1 - j] + 1)
			i = i + 1
			j = j + 1
		else:
			t = 0
	if len(fin) == 0:
		print(0)
	else:
		print(1)
		print(len(fin))
		fin.sort()
		for i in range(0, len(fin)):
			print(fin[i], end=' ')


s = input()
n = len(s)
(l, r) = (0, n - 1)
(ob, cb) = ([], [])
while r >= l:
	if len(ob) == len(cb):
		if s[l] == '(':
			ob.append(l + 1)
		l += 1
	else:
		if s[r] == ')':
			cb.append(r + 1)
		r -= 1
l = len(cb)
ans = ob[:l] + cb[::-1]
if len(ans):
	print(1)
	print(len(ans))
	print(' '.join(map(str, ans)))
else:
	print(0)


s = input().strip()
ls = list(s)
operations = []
k = 0
while True:
	left = 0
	right = len(ls) - 1
	remove = []
	while left < right:
		if ls[left] == ')':
			left += 1
		else:
			while left < right:
				if ls[right] == '(':
					right -= 1
				else:
					remove.append(left)
					remove.append(right)
					left += 1
					right -= 1
					break
	if len(remove) == 0:
		break
	k += 1
	ls = [ls[i] for i in range(len(ls)) if i not in remove]
	operations.append([e + 1 for e in remove])
print(k)
for c in operations:
	print(len(c))
	print(' '.join(map(str, sorted(c))))


s = input()
List = list(s)
a = []
i = 0
j = len(List) - 1
val = len(List)
for i in range(len(List)):
	if List[i] == '(':
		for j in range(val - 1, i, -1):
			if List[j] == ')':
				a.append(i)
				a.append(j)
				val = j
				break
	if i >= j or i == len(List) - 1:
		break
if len(a) == 0:
	print(0)
else:
	print(1)
	print(len(a))
	a.sort()
	for l in a:
		print(l + 1, end=' ')


s = input()
starting = []
ending = []
for i in range(len(s)):
	if s[i] == '(':
		starting.append(i)
	else:
		ending.append(i)
start = 0
c = 0
co = 0
end = -1
removed = []
if len(ending) == 0 or len(starting) == 0:
	print(0)
else:
	while starting[start] < ending[end]:
		removed.append(starting[start])
		removed.append(ending[end])
		start += 1
		end -= 1
		co += 1
		c = 1
		if abs(end) > len(ending) or start > len(starting) - 1:
			break
	print(c)
	removed.sort()
	if c == 0:
		pass
	else:
		print(2 * co)
		for i in removed:
			print(i + 1, end=' ')


s = input().strip()
ops = []
opening = [i for (i, c) in enumerate(s) if c == '('][::-1]
closing = [i for (i, c) in enumerate(s) if c == ')']
while opening and closing and (opening[-1] < closing[-1]):
	op = []
	while opening and closing and (opening[-1] < closing[-1]):
		op.append(opening.pop() + 1)
		op.append(closing.pop() + 1)
	ops.append(sorted(op))
print(len(ops))
for op in ops:
	print(len(op))
	print(' '.join(map(str, op)))


a = input()
r = len(a) - 1
l = 0
cnt = 0
ll = list()
lr = list()
while l < r:
	while l < r and a[r] != ')':
		r -= 1
	while l < r and a[l] != '(':
		l += 1
	if l < r:
		cnt += 1
		ll.append(l)
		lr.append(r)
	l += 1
	r -= 1
q = [0 for i in range(len(a))]
for i in ll:
	q[i] = -1
for i in lr:
	q[i] = -1
n = 0
w = 0
p = ''
for i in q:
	n += 1
	if i == -1:
		p += str(n) + ' '
		w += 1
if w > 0:
	print(1)
	print(w)
	print(p[:-1])
else:
	print(0)


s = input()
s = list(s)
flag = 0
ans = []
while True:
	i = 0
	j = len(s) - 1
	temp = []
	flag = 0
	while i < j:
		if s[i] == '(' and s[j] == ')':
			temp.append(i + 1)
			temp.append(j + 1)
			s[i] = None
			s[j] = None
			flag = 1
			i += 1
			j -= 1
		elif s[i] == ')' and s[j] == ')':
			i += 1
		elif s[i] == '(' and s[j] == '(':
			j -= 1
		elif s[i] == ')' and s[j] == '(':
			i += 1
			j -= 1
	if flag == 0:
		break
	for i in range(s.count(None)):
		s.remove(None)
	ans.append(temp)
print(len(ans))
for i in ans:
	print(len(i))
	i.sort()
	for j in i:
		print(j, end=' ')
	print()


s = input()
i = 0
j = len(s) - 1
ans = []
temp = []
cnt = 0
while i < j:
	while i < j and s[i] == ')':
		i += 1
	while i < j and s[j] == '(':
		j -= 1
	if s[i] == '(' and s[j] == ')':
		cnt += 2
		temp.append(i + 1)
		temp.append(j + 1)
	i += 1
	j -= 1
temp.sort()
if len(temp) == 0:
	print(0)
else:
	print(1)
	print(cnt)
	for i in range(len(temp)):
		print(temp[i], end=' ')
	print('')


import sys
input = sys.stdin.readline
s = input().rstrip()
n = len(s)
l = 0
r = n - 1
ans = []
while r - l > 0:
	while l != r and s[l] != '(':
		l += 1
	while r != l and s[r] != ')':
		r -= 1
	if l != r:
		ans.append(l + 1)
		l += 1
		ans.append(r + 1)
		r -= 1
if len(ans) == 0:
	print(0)
	exit()
else:
	print(1)
	print(len(ans))
	ans.sort()
	print(*ans)


def solve():
	str = input()
	first_index = 0
	last_index = len(str) - 1
	result = list()
	while first_index < last_index:
		if str[first_index] == ')':
			first_index += 1
			continue
		if str[last_index] == '(':
			last_index -= 1
			continue
		result.append(first_index + 1)
		result.append(last_index + 1)
		first_index += 1
		last_index -= 1
	if len(result) == 0:
		print(0)
	else:
		print(1)
		result.sort()
		print(len(result))
		print(*result, sep=' ')
solve()


import sys
input = sys.stdin.readline

def main():
	s = input()
	ansl = []
	ansr = []
	l = 0
	r = len(s) - 1
	while l < r and r > 0 and (l < len(s)):
		while s[l] != '(':
			l += 1
			if l == len(s):
				break
		while s[r] != ')':
			r -= 1
			if r == -1:
				break
		if r >= l and l <= r:
			ansr.append(r + 1)
			ansl.append(l + 1)
		l += 1
		r -= 1
	if ansl and ansr:
		print(1)
		print(len(ansl) * 2)
		print(*ansl + list(reversed(ansr)))
	else:
		print(0)
main()


s = input().strip()
a = []
b = []
n = len(s)
for i in range(n):
	if s[i] == '(':
		a.append(i + 1)
	if s[n - 1 - i] == ')':
		b.append(n - i)
k = min(len(a), len(b))
ans = 0
for i in range(k):
	if a[i] < b[i]:
		ans = i + 1
if ans == 0:
	print(0)
else:
	print(1)
	print(ans * 2)
	for i in range(ans):
		print(a[i], end=' ')
	lb = len(b)
	for i in range(lb - ans, lb):
		print(b[lb - 1 - i], end=' ')


s = input()
n = len(s)
left = 0
right = n - 1
removed = []
while left < right:
	if s[left] == '(' and s[right] == ')':
		removed.append(left + 1)
		removed.append(right + 1)
		left += 1
		right -= 1
	else:
		if s[left] == ')':
			left += 1
		if s[right] == '(':
			right -= 1
if len(removed) == 0:
	print(0)
else:
	print(1)
	print(len(removed))
	print(' '.join(map(str, sorted(removed))))


S = [(i, c == '(') for (i, c) in enumerate(input())]
res = []
while True:
	l = 0
	r = len(S) - 1
	lstack = []
	rstack = []
	while True:
		while l < r and (not S[l][1]):
			l += 1
		while l < r and S[r][1]:
			r -= 1
		if l < r:
			lstack.append(l)
			rstack.append(r)
			l += 1
			r -= 1
		else:
			break
	if not lstack:
		break
	res.append(tuple((S[i][0] + 1 for i in lstack)) + tuple((S[i][0] + 1 for i in reversed(rstack))))
	removed = set(lstack) | set(rstack)
	S = [v for (i, v) in enumerate(S) if i not in removed]
print(len(res))
for r in res:
	print(len(r))
	print(*r)


s = input()
size = len(s)
i = 0
j = size - 1
ans = []
while i < j:
	while i < size and s[i] == ')':
		i += 1
	while j >= 0 and s[j] == '(':
		j -= 1
	if i < size and j >= 0 and (i < j):
		ans.append(i + 1)
		ans.append(j + 1)
		i += 1
		j -= 1
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	ans = sorted(ans)
	for x in ans:
		print(x, end=' ')
	print()


from sys import stdin

def line():
	return stdin.readline().strip()

def main():
	cad = line()
	ini = 0
	fin = len(cad) - 1
	ans = []
	while ini < fin:
		while cad[ini] != '(' and ini != fin:
			ini += 1
		while cad[fin] != ')' and ini != fin:
			fin -= 1
		if ini == fin:
			break
		ans.append(ini + 1)
		ans.append(fin + 1)
		ini += 1
		fin -= 1
	if not len(ans):
		print(0)
	else:
		print(1, '\n', len(ans))
		for item in sorted(ans):
			print(item, end=' ')
main()


s = input()
k = [[0, 0] for i in range(len(s))]
left = 0
right = 0
for i in range(len(s)):
	if s[i] == '(':
		left += 1
	k[i][0] = left
	k[-i - 1][1] = right
	if s[-i - 1] == ')':
		right += 1
x = 0
ans = -1
for i in range(len(k)):
	if k[i][0] == k[i][1] and k[i][0] > ans:
		x = i
		ans = k[i][0]
removed = []
i = 0
j = 0
while j < ans:
	if s[i] == '(':
		removed.append(i + 1)
		j += 1
	i += 1
i = 1
j = 0
while j < ans and len(s) - i >= 0:
	if s[len(s) - i] == ')':
		removed.append(len(s) - i + 1)
		j += 1
	i += 1
removed.sort()
if len(removed):
	print(1)
	print(len(removed))
	print(*removed)
else:
	print(0)


from math import *
s = [1 if i == '(' else -1 for i in input()]
n = len(s)
te = []
co = []
c = 0
for i in range(n - 1, -1, -1):
	if s[i] < 0:
		c += 1
	co.append(c)
co.reverse()
co.append(0)
ind = []
for i in range(n):
	if s[i] > 0:
		ind.append(i)
su = 0
for i in ind:
	te = co[i]
	su += co[i]
if su <= 0:
	print(0)
else:
	le = len(ind)
	ma = 0
	mii = -1
	for i in range(le):
		te = min(ma + 1, co[ind[i]])
		if te > ma:
			mii = i
			ma = te
	print(1)
	print(ma * 2)
	a = []
	for i in range(mii + 1):
		a.append(ind[i] + 1)
	c = ma
	j = n - 1
	while c > 0:
		if s[j] < 0:
			c -= 1
			a.append(j + 1)
		j -= 1
	a.sort()
	print(' '.join(map(str, a)))


s = list(input())
(p1, p2) = (0, len(s) - 1)
res = []
while p1 < p2:
	if s[p1] == '(':
		while p1 < p2:
			if s[p2] == ')':
				res.extend([p1 + 1, p2 + 1])
				p2 -= 1
				break
			p2 -= 1
	p1 += 1
if len(res) == 0:
	print(0)
else:
	print(1)
	res.sort()
	print(len(res))
	for i in res:
		print(i, end=' ')


s = list(input())
i = 0
j = len(s) - 1
l = []
while i <= j:
	if s[i] == '(' and s[j] == ')':
		l.append(i + 1)
		l.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == ')':
		i += 1
	else:
		j -= 1
if len(l) == 0:
	print(0)
else:
	print(1)
	print(len(l))
	for i in sorted(l):
		print(i, end=' ')


s = input()
to_ans = [False for _ in range(len(s))]

def solve(s, left, right):
	if left >= right:
		return
	while left <= right and s[left] == ')':
		left += 1
	while right >= left and s[right] == '(':
		right -= 1
	if left >= right:
		return
	else:
		to_ans[left] = True
		to_ans[right] = True
		solve(s, left + 1, right - 1)
solve(s, 0, len(s) - 1)
if sum(to_ans) == 0:
	print(0)
else:
	print(1)
	print(sum(to_ans))
	print(' '.join([str(item + 1) for item in range(len(s)) if to_ans[item]]))


a = input()
i = 0
s = list()
e = list()
f = list()
r = []
while i < len(a):
	if a[i] == '(':
		s.append(i + 1)
	i += 1
i = 0
while i < len(a):
	if a[i] == ')':
		e.append(i + 1)
	i += 1
if len(s) == 0 or len(e) == 0:
	print(0)
else:
	e.sort(reverse=True)
	m = min(len(s), len(e))
	for i in range(m):
		if s[i] < e[i]:
			r.append(s[i])
			r.append(e[i])
	if len(r) == 0:
		print(0)
	else:
		print(1)
		print(len(r))
		r.sort()
		print(*r)


s = input()
l1 = []
l2 = []
for i in range(len(s)):
	if s[i] == '(':
		l1.append(i)
	else:
		l2.append(i)
l2 = l2[::-1]
l = []
for i in range(min(len(l1), len(l2))):
	if l1[i] > l2[i]:
		break
	else:
		l.append(l1[i] + 1)
		l.append(l2[i] + 1)
l.sort()
if len(l) == 0:
	print(0)
else:
	print(1)
	print(len(l))
	print(*l)


import sys
S = [s == '(' for s in input()]
N = len(S)
outputs = []
falses = [i for (i, s) in enumerate(S) if not s]
trues = [i for (i, s) in enumerate(S) if s]
trues.reverse()
while falses and trues and (trues[-1] < falses[-1]):
	outputs.append(trues[-1])
	outputs.append(falses[-1])
	trues.pop()
	falses.pop()
if outputs:
	print('1')
	print(len(outputs))
	print(' '.join([str(x + 1) for x in sorted(outputs)]))
else:
	print('0')


from collections import deque
n = input()
res = []
while True:
	bfres = []
	close = deque((ind for (ind, i) in enumerate(n) if i == ')'))
	opn = deque((ind for (ind, i) in enumerate(n) if i == '('))
	left = []
	right = []
	while len(close) and len(opn):
		a = opn.popleft()
		b = close.pop()
		if a < b:
			left.append(a + 1)
			right.append(b + 1)
		else:
			break
	bfres = left + right[::-1]
	if not len(bfres):
		break
	newn = []
	for (ind, i) in enumerate(n):
		if ind + 1 not in bfres:
			newn.append(i)
	n = ''.join(newn)
	res.append(bfres[:])
print(len(res))
for i in res:
	print(len(i))
	print(*i)


import math
s = list(input().strip())
l = []
i = 0
j = len(s) - 1
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			l.append(i + 1)
			l.append(j + 1)
			i += 1
			j -= 1
			continue
		else:
			j -= 1
	else:
		i += 1
l.sort()
if len(l) == 0:
	print('0')
else:
	print('1')
	print(len(l))
	print(*l)


from collections import Counter

def check(st):
	ind = 0
	for i in range(len(st)):
		if st[i] == '(':
			ind = i
			break
	for i in range(ind, len(st)):
		if st[i] == ')':
			return False
	return True
s = [i for i in input()]
k = 1
o = []
if not (check(s) or s == ['('] * len(s) or s == [')'] * len(s)):
	rp = [0]
	lp = [0]
	m = 0
	mind = 0
	for i in range(1, len(s)):
		c1 = Counter(s[:i])
		c2 = Counter(s[i:])
		if '(' in c1 and ')' in c2 and (min(c1['('], c2[')']) > m):
			mind = i
			m = min(c1['('], c2[')'])
	l = 0
	r = len(s) - 1
	c1 = 0
	c2 = 0
	while True:
		if l >= mind and r < mind:
			break
		if s[l] == '(' and c1 < m and (l < mind):
			o.append(l + 1)
			c1 += 1
		if s[r] == ')' and c2 < m and (r >= mind):
			o.append(r + 1)
			c2 += 1
		l += 1
		r -= 1
	print(k)
	print(len(o))
	print(*sorted(o))
else:
	print(0)


n = str(input())
count = 0
lol = len(n) - 1
l = []
if len(n) % 2 == 0:
	for i in range(len(n)):
		if n[i] == '(':
			for j in range(lol, i, -1):
				if n[i] != n[j]:
					l.append(i)
					l.append(j)
					count += 1
					lol = j - 1
					break
else:
	for i in range(len(n)):
		if n[i] == '(':
			for j in range(lol, i, -1):
				if n[i] != n[j]:
					l.append(i)
					l.append(j)
					count += 1
					lol = j - 1
					break
l.sort()
if count != 0:
	print(1)
	print(count * 2)
	for i in range(len(l)):
		print(l[i] + 1, end=' ')
else:
	print(0)


s = input()
l = -1
r = len(s)
la = []
ra = []
while True:
	while True:
		l += 1
		if s[l] == '(':
			la.append(l + 1)
			break
		if l == r or l == len(s) - 1:
			if l == len(s) - 1:
				l += 1
			break
	if l == r or l == len(s):
		break
	while True:
		r -= 1
		if s[r] == ')':
			ra.append(r + 1)
			break
		if l == r or r == 0:
			la = la[:-1]
			if r == 0:
				r -= 1
			break
	if l == r or r == -1:
		break
if len(la) == 0:
	print(0)
else:
	print(1)
	ra = ra[::-1]
	la += ra
	print(len(la))
	s = ''
	for i in la:
		s += str(i) + ' '
	print(s[:-1])


from sys import *
import math
input = stdin.readline
I = int
R = range
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())
sJoin = lambda a, sep: '{}'.format(sep).join(a)
arrJoin = lambda a, sep: '{}'.format(sep).join(map(str, a))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def main():
	s = input().strip()
	(start, end) = ([], [])
	for i in range(len(s)):
		if s[i] == '(':
			start.append(i + 1)
		if s[i] == ')':
			end.append(i + 1)
	(i, j) = (0, len(end) - 1)
	ans = []
	while i < len(start) and j >= 0:
		if start[i] > end[j]:
			break
		ans.append(start[i])
		ans.append(end[j])
		i += 1
		j -= 1
	ans.sort()
	if len(ans) == 0:
		print(0)
	else:
		print(1)
		print(len(ans))
		print(*ans)
main()


s = input()
remainder = ''
rm = []
start = 0
end = len(s) - 1
while start < end:
	if s[start] == '(' and s[end] == ')':
		rm += [start + 1, end + 1]
		start += 1
		end -= 1
	elif s[start] != '(':
		start += 1
	else:
		end -= 1
if rm == []:
	print(0)
else:
	print(1)
	print(len(rm))
	print(*sorted(rm))


def main():
	s = list(input())
	o = s.count('(')
	c = s.count(')')
	ao = [-1] * (o + 1)
	ac = [-1] * (c + 1)
	k = 0
	ml = []
	ans = -1
	while 1:
		ans = -1
		(l, m) = (1, 1)
		o = s.count('(')
		c = s.count(')')
		ao = [-1] * (o + 1)
		ac = [-1] * (c + 1)
		for i in range(len(s)):
			if s[i] == '(':
				ao[l] = i
				l += 1
			elif s[i] == ')':
				ac[c - m + 1] = i
				m += 1
		ans = -1
		for i in range(min(o, c), 0, -1):
			if ao[i] > ac[i]:
				pass
			elif ao[i] != -1 and ac[i] != -1 and (ao[i] < ac[i]):
				ans = i
				k += 1
				break
			else:
				break
		if ans != -1:
			ml.append([])
			for i in range(ans):
				s[ao[i + 1]] = ''
				s[ac[i + 1]] = ''
				ml[k - 1].append(ao[i + 1] + 1)
				ml[k - 1].append(ac[i + 1] + 1)
		else:
			break
	print(k)
	for i in range(k):
		print(len(ml[i]))
		ml[i].sort()
		print(' '.join(list(map(str, ml[i]))))
main()


s = list(input())
l = len(s)
o = 0
c = l - 1
ans = []
k = 0
while o < c:
	if s[o] == '(':
		if s[c] == ')':
			ans.append(o + 1)
			ans.append(c + 1)
			k = 1
			o += 1
		c -= 1
	else:
		o += 1
if k == 0:
	print(0)
else:
	ans.sort()
	print(k)
	print(len(ans))
	print(*ans)


stringa = input()
n = len(stringa)
left = [n for i in range(len(stringa))]
j = 0
for i in range(len(stringa)):
	if stringa[i] == '(':
		left[j] = i
		j += 1
right = [-1 for i in range(len(stringa))]
j = 0
for i in range(len(stringa) - 1, -1, -1):
	if stringa[i] == ')':
		right[j] = i
		j += 1
ans = -1
for i in range(n):
	if left[i] < right[i]:
		ans = i
if ans == -1:
	print(0)
else:
	lista = []
	print(1)
	for i in range(ans + 1):
		lista.append(left[i] + 1)
	for i in range(ans, -1, -1):
		lista.append(right[i] + 1)
	print(len(lista))
	print(*lista)


s = ')' + input() + '('
(i, j) = (0, 1002)
a = []
while i < j:
	if i:
		a += (i, j)
	i = s.find('(', i + 1)
	j = s.rfind(')', 0, j)
print(0 + (a > []), *(a and [len(a)] + sorted(a)))


from math import *
t = 1
for i in range(t):
	s = list(input())
	n = len(s)
	a = []
	b = []
	for i in range(n):
		if s[i] == '(':
			a.append(i)
		else:
			b.append(i)
	(l, r) = (0, len(b) - 1)
	arr = []
	while l < len(a) and r >= 0:
		if a[l] > b[r]:
			break
		arr.append(a[l] + 1)
		arr.append(b[r] + 1)
		l = l + 1
		r = r - 1
	if len(arr) > 0:
		print(1)
		print(len(arr))
		arr.sort()
		print(*arr)
	else:
		print(0)


import math
q = 1
for _ in range(q):
	s = list(input())
	n = len(s)
	i = 0
	j = n - 1
	left = []
	right = []
	while i < j:
		if s[i] == '(' and s[j] == ')':
			right.append(j + 1)
			left.append(i + 1)
			j -= 1
			i += 1
		elif s[i] == '(':
			j -= 1
		elif s[i] == ')':
			i += 1
		else:
			j -= 1
			i += 1
	m = left + right
	m.sort()
	if len(m) == 0:
		print(0)
	elif len(m) == 0:
		print(0)
	else:
		print(1)
		print(len(m))
		print(*m)


import math
s = input()
k = 0
t1 = -1
t2 = -1
s1 = s[::-1]
m = []
while True:
	t1 = s.find('(', t1 + 1)
	t2 = s1.find(')', t2 + 1)
	if t1 == -1 or t2 == -1 or t1 > len(s) - 1 - t2:
		break
	else:
		k += 2
		m.extend([t1 + 1, len(s) - 1 - t2 + 1])
if k > 0:
	print(1)
	print(k)
	m.sort()
	for i in range(len(m)):
		print(m[i], end=' ')
else:
	print(0)


from itertools import accumulate

def solve(p, L, R):
	if p[1] is '(' and L <= R:
		return True
	if p[1] is ')' and L >= R:
		return True
	return False
s = input()
left = list(accumulate([1 if ch is '(' else 0 for ch in s]))
right = list(reversed(list(accumulate([1 if ch is ')' else 0 for ch in reversed(s)]))))
ans = list(map(lambda x: str(x[0] + 1), filter(lambda p: solve(p, left[p[0]], right[p[0]]), enumerate(s))))
if len(ans) == 0:
	print('0')
else:
	print('1')
	print(len(ans))
	print(' '.join(ans))


s = input()
l1 = []
l2 = []
f = 0
c = 0
r = len(s) - 1
while r >= f:
	if s[f] == '(' and s[r] == ')':
		c += 2
		l1 += [f + 1]
		l2 += [r + 1]
		f += 1
		r -= 1
	elif s[f] == '(':
		r -= 1
	elif s[r] == ')':
		f += 1
	else:
		f += 1
		r -= 1
if c == 0:
	print(0)
else:
	print(1)
	print(c)
	print(*l1, end=' ')
	print(*l2[::-1])


s = list(input())
n = len(s)
x = []
y = []
i = 0
j = n - 1
while i < j:
	if s[i] == '(' and s[j] == ')':
		x.append(i)
		y.append(j)
		i += 1
		j -= 1
	if s[i] == ')':
		i += 1
	if s[j] == '(':
		j -= 1
y = y[::-1]
l = 2 * len(x)
if l == 0:
	print(0)
else:
	print(1)
	print(l)
	for i in x:
		print(i + 1, end=' ')
	for i in y:
		print(i + 1, end=' ')
	print()


s = input()
l = []
l1 = []
for i in range(len(s)):
	if s[i] == '(':
		l.append(i)
for i in range(len(s) - 1, -1, -1):
	if s[i] == ')':
		l1.append(i)
p = min(len(l1), len(l))
i = 0
removal = []
while i < p:
	if l[i] > l1[i]:
		break
	removal.append(l[i] + 1)
	removal.append(l1[i] + 1)
	i += 1
if len(removal) > 0:
	print(1)
	print(len(removal))
	print(*sorted(removal))
else:
	print(0)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
from collections import deque
import io
import os

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
s = list(input())
steps = 0
flag = True
ans = []
(i, j) = (0, len(s) - 1)
while i <= j:
	while i < len(s) and s[i] != '(':
		i += 1
	while j >= 0 and s[j] != ')':
		j -= 1
	if i < j:
		s[i] = ''
		s[j] = ''
		ans.append(i + 1)
		ans.append(j + 1)
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*sorted(ans))


s = input()
o = []
c = []
for i in range(len(s)):
	if s[i] == '(':
		o.append(i)
	else:
		c.append(i)
ans = []
start = 0
end = len(c) - 1
n = len(o)
while start < n and end >= 0:
	if o[start] > c[end]:
		break
	ans.append(o[start] + 1)
	ans.append(c[end] + 1)
	start += 1
	end -= 1
m = len(ans)
if m == 0:
	print(0)
else:
	print(1)
	print(m)
	ans.sort()
	print(*ans)


s = input()
f = []
b = []
for i in range(len(s)):
	if s[i] == '(':
		f.append(i)
	else:
		b.append(i)
p1 = 0
p2 = len(b) - 1
ans = []
while p1 < len(f) and p2 >= 0 and (f[p1] < b[p2]):
	ans.append(f[p1])
	ans.append(b[p2])
	p1 += 1
	p2 -= 1
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	ans.sort()
	for i in ans:
		print(i + 1, end=' ')


s = input()
n = len(s)
ans = []
l = 0
r = n - 1
while l < r:
	if s[l] != '(':
		l += 1
	elif s[r] != ')':
		r -= 1
	if s[l] == '(' and s[r] == ')':
		ans.append(l + 1)
		ans.append(r + 1)
		l += 1
		r -= 1
if len(ans):
	print(1)
else:
	print(0)
	exit()
ans.sort()
print(len(ans))
print(*ans)


def prin(A):
	print(len(A))
	print(' '.join(map(str, A)))

def do(S):
	n = len(S)
	c_o = {-1: 0}
	for (i, tp) in enumerate(S):
		(it, ind) = tp
		if it == '(':
			c_o[i] = c_o[i - 1] + 1
		else:
			c_o[i] = c_o[i - 1]
	c_c = {n: 0}
	for i in range(n - 1, -1, -1):
		it = S[i][0]
		if it == ')':
			c_c[i] = c_c[i + 1] + 1
		else:
			c_c[i] = c_c[i + 1]
	to_rem = 0
	for i in range(n):
		if c_o[i] <= c_c[i + 1]:
			to_rem = c_o[i]
		else:
			break
	if to_rem == 0:
		print(0)
		return
	else:
		print(1)
		ans = []
		st = []
		(ro, rc) = (0, 0)
		for tp in S:
			(it, ind) = tp
			if ro < to_rem:
				if it == '(':
					ro += 1
					ans.append(ind)
				else:
					st.append(tp)
			elif rc < to_rem:
				if it == ')':
					if st and st[-1][0] == '(':
						ans.append(ind)
						rc += 1
					else:
						st.append(tp)
				else:
					st.append(tp)
		if rc == to_rem:
			ans.sort()
			prin(ans)
		else:
			while st and rc < to_rem:
				tp = st.pop()
				if tp[0] == ')':
					ans.append(tp[1])
					rc += 1
			ans.sort()
			prin(ans)

def solve(S):
	n = len(S)
	li = []
	arr = [(S[i], i + 1) for i in range(n)]
	do(arr)
st = input()
solve(st)


s = input()
(oL, cL) = ([], [])
for i in range(len(s)):
	if s[i] == '(':
		oL.append(i)
	if s[i] == ')':
		cL.append(i)
(oPt, cPt) = (0, len(cL) - 1)
remov = []
while oPt < len(oL) and cPt >= 0:
	if oL[oPt] > cL[cPt]:
		break
	remov.append(oL[oPt])
	remov.append(cL[cPt])
	oPt += 1
	cPt -= 1
remov.sort()
if len(remov) == 0:
	print(0)
else:
	print('1\n{}\n{}'.format(len(remov), ' '.join((str(x + 1) for x in remov))))


s = input()
lst = list(s)
res = []
i = 0
j = len(s) - 1
count = 0
while i < j:
	if lst[i] == '(' and lst[j] == ')':
		res.append(i + 1)
		res.append(j + 1)
		i += 1
		j -= 1
		count += 2
	elif lst[i] == '(' and lst[j] == '(':
		j -= 1
	elif lst[i] == ')':
		i += 1
if count == 0:
	print(0)
else:
	res.sort()
	print(1)
	print(count)
	for ele in res:
		print(ele, end=' ')


s = input()
low = 0
high = len(s) - 1
res = []
while low < high:
	if s[low] == '(':
		while low < high and s[high] != ')':
			high -= 1
		if low < high:
			res.append(low + 1)
			res.append(high + 1)
			high -= 1
		else:
			break
	low += 1
if res:
	print(1)
	print(len(res))
	res.sort()
	print(*res)
else:
	print(0)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	s = list(' ' + stdin.readline().strip() + ' ')
	n = len(s)
	output = []
	while True:
		j = n - 2
		i = 1
		L = []
		R = []
		while i < j:
			while i < n and s[i] != '(':
				i += 1
			while 0 < j and s[j] != ')':
				j -= 1
			if i < j:
				L.append(i)
				R.append(j)
				s[i] = ' '
				s[j] = ''
				i += 1
				j -= 1
		R.reverse()
		if len(L + R) == 0:
			break
		output.append(L + R)
	stdout.write('%d\n' % len(output))
	for subseq in output:
		stdout.write('%d\n' % len(subseq))
		stdout.write(' '.join([str(x) for x in subseq]) + '\n')
	return 0
main()


s = input()
i = 0
j = len(s) - 1
ls = []
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			ls.append(i + 1)
			ls.append(j + 1)
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
if len(ls) > 0:
	print(1)
	print(len(ls))
	print(*sorted(ls))
else:
	print(0)


a = input()
s1 = []
s2 = []
(c, o) = (0, len(a) - 1)
while o - c >= 1:
	while o >= 0 and a[o] == '(':
		o -= 1
	while c < len(a) and a[c] == ')':
		c += 1
	if o >= 0 and c < len(a) and (c < o):
		s1.append(c + 1)
		s2.append(o + 1)
		c += 1
		o -= 1
if not s1:
	print(0)
	exit(0)
print(1)
print(2 * len(s1))
print(*s1, end=' ')
s2.reverse()
print(*s2)


import sys
input = sys.stdin.readline
s = list(map(str, input().split()))[0]
i = 0
j = len(s) - 1
cnt = 0
left = []
right = []
while i < j:
	if s[i] != '(':
		i += 1
	elif s[j] != ')':
		j -= 1
	else:
		left.append(i + 1)
		right.append(j + 1)
		i += 1
		j -= 1
if left and right:
	right = right[::-1]
	print(1)
	print(len(left) + len(right))
	print(*left + right, sep=' ')
else:
	print(0)


def brac(t):
	x = len(t)
	a = []
	b = []
	c = []
	for i in range(x):
		if t[i] == '(':
			a.append(i)
		else:
			b.append(i)
	while len(a) > 0 and len(b) > 0:
		if a[0] < b[-1]:
			c.append(a[0] + 1)
			c.append(b[-1] + 1)
			a.pop(0)
			b.pop()
		else:
			break
	c.sort()
	if len(c) > 0:
		print(1)
		print(len(c))
		print(*c)
	else:
		print(0)
t = input()
brac(t)


s = input()
left = []
right = []
res = []
ind = 1
for g in s:
	if g == '(':
		left.append(ind)
	else:
		right.append(ind)
	ind += 1
right.reverse()
ind = min(len(left), len(right))
for k in range(ind):
	if left[k] < right[k]:
		res.append(left[k])
		res.append(right[k])
if res:
	print(1)
	print(len(res))
	res.sort()
	res0 = [str(j) for j in res]
	print(' '.join(res0))
else:
	print(0)


inp = input()
n = len(inp)
left = []
right = []
for i in range(0, n):
	if inp[i] == '(':
		left.append(i)
	else:
		right.append(i)
q = len(right) - 1
p = 0
ans = []
while q >= 0 and p < len(left) and (left[p] < right[q]):
	ans.append(left[p])
	ans.append(right[q])
	p += 1
	q -= 1
if len(ans) > 0:
	print(1)
	print(len(ans))
	ans.sort()
	for i in ans:
		print(i + 1, end=' ')
	print()
else:
	print(0)


s = input()

def check(i):
	(u, v) = (s[:i], s[i:])
	w = min(u.count('('), v.count(')'))
	(lw, rw) = (w, w)
	(ls, rs) = ([], [])
	res = [True] * len(s)
	for i in range(len(s)):
		if lw and s[i] == '(':
			ls.append(i + 1)
			lw -= 1
			res[i] = False
	for i in range(len(s) - 1, -1, -1):
		if rw and s[i] == ')':
			rs.append(i + 1)
			rw -= 1
			res[i] = False
	res = [s[i] for i in range(len(s)) if res[i]]
	lb = len(s)
	rb = -1
	for i in range(len(res)):
		if res[i] == '(':
			lb = min(lb, i)
		if res[i] == ')':
			rb = max(rb, i)
	return (lb > rb, ls + list(reversed(rs)))
for i in range(len(s)):
	(v, w) = check(i)
	if v:
		if w:
			print(1)
			print(len(w))
			print(*w)
		else:
			print(0)
		exit()
print(0)


s = input()
lst = []
l = len(s) - 1
if '(' in s:
	for i in range(l):
		if s[i] == '(':
			for j in range(l, i, -1):
				if s[j] == ')':
					lst.append(i + 1)
					lst.append(j + 1)
					l = j - 1
					break
	if lst:
		print(1)
		lst.sort()
		print(len(lst))
		for i in lst:
			print(i, end=' ')
	else:
		print(0)
else:
	print(0)


s = input()
j = len(s)
i = 1
k1 = []
k2 = []
while i < j:
	if s[i - 1] != s[j - 1]:
		if s[i - 1] == '(':
			k1.append(i)
			k2.append(j)
		i += 1
		j -= 1
	elif s[i - 1] == '(':
		j -= 1
	else:
		i += 1
if len(k1) != 0:
	print(1)
	k = k1 + k2[::-1]
	print(len(k))
	for i in k:
		print(i, end=' ')
else:
	print(0)


a = []
b = []
z = []
k = op = num = 0
for i in input():
	if i == '(':
		a.append(k)
	else:
		b.append(k)
	k = k + 1
b.reverse()
for (x, y) in zip(a, b):
	if x > y:
		break
	else:
		z = z + [x + 1, y + 1]
		num = num + 2
		op = 1
print(op)
if op == 1:
	print(num)
	print(*sorted(z))


s = input()
ud = []
r = len(s) - 1
for l in range(len(s)):
	if l == r:
		break
	if s[l] == '(':
		while s[r] == '(' and r > l:
			r -= 1
		if s[r] == ')':
			ud.append(l + 1)
			ud.append(r + 1)
			r -= 1
if len(ud) == 0:
	print(0)
else:
	print(1)
	print(len(ud))
	print(' '.join(map(str, sorted(ud))))


s = input()
i = 0
l = []
l2 = []
j = len(s) - 1
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			l.append(i + 1)
			l2.insert(0, j + 1)
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
l += l2
if not l:
	print(0)
else:
	print(1)
	print(len(l))
	for i in l:
		print(i, end=' ')


a = input()
a = list(a)
i = -1
j = len(a)
k = 0
m1 = []
m2 = []
while i < j:
	while True:
		i += 1
		if i >= j:
			break
		if a[i] == '(':
			m1.append(i + 1)
			break
	while True:
		j -= 1
		if i >= j:
			break
		if a[j] == ')':
			m2.append(j + 1)
			break
if len(m1) > 0 and len(m2) > 0:
	print(1)
	print(2 * min(len(m1), len(m2)))
	m2.reverse()
	for i in range(len(m1) - len(m2)):
		m1.pop()
	print(' '.join(map(str, m1 + m2)))
else:
	print(0)


t = input()
cn1 = []
cn2 = []
r = []
for i in range(len(t)):
	if t[i] == '(':
		cn1.append(i + 1)
	else:
		cn2.append(i + 1)
cn2 = cn2[::-1]
for i in range(min(len(cn2), len(cn1))):
	if cn2[i] > cn1[i]:
		r.append(cn1[i])
		r.append(cn2[i])
	else:
		break
r.sort()
if len(r) != 0:
	print(1)
print(len(r))
print(*r)


import sys
s = sys.stdin.readline().rstrip()
re = []
while True:
	left = []
	cnt = 0
	for (i, c) in enumerate(s):
		if c == '(':
			cnt += 1
		left.append(cnt)
	right = []
	cnt = 0
	for (i, c) in enumerate(s[::-1]):
		if c == ')':
			cnt += 1
		right.insert(0, cnt)
	chk = 0
	for i in range(len(s)):
		if left[i] >= right[i]:
			chk = right[i]
			break
	if chk == 0:
		break
	tmp = []
	cnt = 0
	for (i, c) in enumerate(s):
		if c == '(':
			tmp.append(i + 1)
			cnt += 1
		if cnt == chk:
			break
	cnt = 0
	for (i, c) in enumerate(s[::-1]):
		if c == ')':
			tmp.append(len(s) - i)
			cnt += 1
		if cnt == chk:
			break
	tmp.sort()
	re.append(tmp)
	for (idx, i) in enumerate(tmp):
		s = s[:i - 1 - idx] + s[i - idx:]
print(len(re))
for r in re:
	print(len(r))
	for i in r:
		print(i, end=' ')
	print('')


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
string = input()

def check(s):
	x = False
	for ch in s:
		if ch == '(':
			x = True
		if ch == ')' and x == True:
			return True
	return False
final_ans = []
dicti = {'(': [], ')': []}
stack = []
if check(string) == False:
	print(0)
else:
	while check(string):
		arr = []
		ans = []
		for i in range(len(string)):
			ch = string[i]
			if ch == '(':
				arr.append(i)
		ptr = 0
		for i in range(len(string) - 1, -1, -1):
			ch = string[i]
			if ch == ')' and ptr < len(arr) and (arr[ptr] < i):
				ans.append(arr[ptr])
				ans.append(i)
				ptr += 1
		ans.sort()
		final_ans.append([len(ans), ans])
		newStr = ''
		for i in range(len(string)):
			if i not in ans:
				newStr += string[i]
		string = newStr
	print(len(final_ans))
	for i in final_ans:
		print(i[0])
		for i in i[1]:
			print(i + 1, end=' ')
		print()


import os, sys
if os.path.exists('inp.txt'):
	sys.stdin = open('inp.txt', 'r')

def _():
	return sys.stdin.readline()

def __():
	return sys.stdin.readline().split()
maxn = 2005
inp = __()
s = inp[0]
k = 0
q = [[] for i in range(maxn)]
dd = [0 for i in range(maxn)]
while True:
	l = 0
	r = len(s) - 1
	check = 0
	while l <= r:
		if not check and s[l] == '(':
			check = 1
		if check and s[r] == ')':
			q[k].append(r + 1)
			q[k].append(l + 1)
			check = 0
			r -= 1
		if not check:
			l += 1
		else:
			r -= 1
	if not len(q[k]):
		break
	for v in q[k]:
		dd[v - 1] = 1
	t = ''
	for i in range(len(s)):
		if not dd[i]:
			t += s[i]
		else:
			dd[i] = 0
	s = t
	q[k].sort()
	k += 1
print(k)
for i in range(k):
	print(len(q[i]))
	print(*q[i])


import sys
input = sys.stdin.readline

def main():
	S = input().strip()
	ans = []
	l = 0
	r = len(S) - 1
	while True:
		while l <= len(S) - 1 and S[l] != '(':
			l += 1
		if l == len(S):
			break
		while r >= 0 and S[r] != ')':
			r -= 1
		if r == 0:
			break
		if r <= l:
			break
		else:
			ans.append(l + 1)
			ans.append(r + 1)
			l += 1
			r -= 1
	if len(ans) == 0:
		print(0)
		return
	print(1)
	print(len(ans))
	ans.sort()
	print(*ans)
main()


n = input()
ans = 0
ansArr = []
while True:
	r = n[::-1]
	if n.count('(') == 0 or n.count(')') == 0:
		break
	if r.index(')') + n.index('(') >= len(n):
		break
	a = False
	ans += 1
	while a == False:
		if n.count('(') == 0 or n.count(')') == 0:
			ansArr.append(-1)
			break
		o = n.index('(')
		p = r.index(')')
		if o + p >= len(n):
			a = True
			ansArr.append(-1)
		else:
			ansArr.append(o + 1)
			ansArr.append(len(n) - p)
			n = n[:o] + '-' + n[o + 1:]
			n = n[:len(n) - p - 1] + '-' + n[len(n) - p:]
			r = n[::-1]
print(ans)
for i in range(ans):
	print(ansArr.index(-1))
	k = ansArr[:ansArr.index(-1)]
	k.sort()
	for j in range(ansArr.index(-1)):
		print(k[j], end=' ')
	print()
	ansArr = ansArr[ansArr.index(-1) + 1:]


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))

def solve():
	s = input().strip()
	a = []
	b = []
	c = []
	ans = []
	f = 1
	(p, k) = (-1, -1)
	for i in range(len(s)):
		if s[i] == '(':
			b.append(i + 1)
		else:
			c.append(i + 1)
	h = 0
	while h != len(b) and len(c):
		if b[h] > c[-1]:
			h += 1
			c.pop()
			continue
		ans.append(b[h])
		ans.append(c[-1])
		h += 1
		c.pop()
	if len(ans) == 0:
		print(0)
	else:
		print(1)
		print(len(ans))
		ans.sort()
		print(*ans)
for _ in range(1):
	solve()


import sys
import copy
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	arr = insr()
	n_opr = 0
	size = []
	removed = []
	while True:
		if arr == '':
			break
		b_open = [0 for i in range(len(arr) + 1)]
		b_clo = [0 for i in range(len(arr) + 1)]
		for i in range(0, len(arr)):
			if arr[i] == '(':
				b_open[i + 1] = b_open[i] + 1
			else:
				b_open[i + 1] = b_open[i]
		b_open.pop(0)
		for i in range(len(arr) - 1, -1, -1):
			if arr[i] == ')':
				b_clo[i] = b_clo[i + 1] + 1
			else:
				b_clo[i] = b_clo[i + 1]
		b_clo.pop(-1)
		diff = [min(b_clo[i], b_open[i]) for i in range(len(arr))]
		v_open = max(diff)
		o = []
		v_closed = v_open
		c = []
		index = diff.index(v_open)
		if v_open == 0:
			break
		next_itr_l = 0
		i = 0
		while True:
			if v_open == 0:
				break
			if arr[i] == '(':
				v_open = v_open - 1
				o.append(i)
			else:
				next_itr_l = next_itr_l + 1
			i = i + 1
		j = len(arr) - 1
		next_itr_r = 0
		while True:
			if v_closed == 0:
				break
			if arr[j] == ')':
				v_closed = v_closed - 1
				c.append(j)
			else:
				next_itr_r = next_itr_r + 1
			j = j - 1
		c.reverse()
		next_itr = ''
		for k in range(0, next_itr_l):
			next_itr = next_itr + ')'
		for k in range(i, j + 1):
			next_itr = next_itr + arr[k]
		for k in range(0, next_itr_r):
			next_itr = next_itr + '('
		size.append(len(c) + len(o))
		c = [c[i] + 1 for i in range(len(c))]
		o = [o[i] + 1 for i in range(len(o))]
		removed.append(o + c)
		n_opr = n_opr + 1
		arr = copy.deepcopy(next_itr)
	print(n_opr)
	if size != []:
		for i in range(n_opr):
			print(size[i])
			pr_list(removed[i])
	return
main()


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(S):
	l = [0]
	for c in S:
		if c == '(':
			l.append(l[-1] + 1)
		else:
			l.append(l[-1])
	l.pop(0)
	l.append(0)
	r = [0]
	for c in S[::-1]:
		if c == ')':
			r.append(r[-1] + 1)
		else:
			r.append(r[-1])
	r.reverse()
	r.pop()
	r.append(0)
	delcan = []
	for i in range(len(S)):
		if l[i] > r[i]:
			break
		if l[i] > l[i - 1]:
			delcan.append(i)
	for i in range(len(S) - 1, -1, -1):
		if r[i] > l[i]:
			break
		if r[i] > r[i + 1]:
			delcan.append(i)
	delcan.sort()
	delcan = [v + 1 for v in delcan]
	if delcan:
		print(1)
		print(len(delcan))
		print(*delcan)
	else:
		print(0)

def main():
	S = read_str()
	slv(S)
main()


s = input().rstrip()
f = []
b = []
for (i, v) in enumerate(s):
	if v == '(':
		f.append(i + 1)
	else:
		b.append(i + 1)
i = 0
ver = []
while i < min(len(f), len(b)):
	if f[i] > b[-(i + 1)]:
		ind = i
		break
	ver.extend([f[i], b[-i - 1]])
	i += 1
if not len(ver):
	print(0)
else:
	print(1)
	print(len(ver))
	print(' '.join(map(str, sorted(ver))))


from sys import stdin, stdout
t = 1
for _ in range(t):
	s = stdin.readline().strip()
	arr1 = [0]
	arr2 = [0]
	for i in s:
		if i == '(':
			arr1.append(arr1[-1] + 1)
		else:
			arr1.append(arr1[-1])
	arr1.pop(0)
	for i in s[::-1]:
		if i == ')':
			arr2.append(arr2[-1] + 1)
		else:
			arr2.append(arr2[-1])
	arr2 = arr2[::-1]
	arr2.pop(-1)
	ansarr = []
	sol = -1
	ansind = -1
	for i in range(len(arr1)):
		t = min(arr1[i], arr2[i])
		if t > sol:
			ansind = i
			sol = t
	if sol > 0:
		stdout.write('1\n')
		stdout.write(str(2 * sol) + '\n')
		tsol = sol
		for i in range(ansind + 1):
			if s[i] == '(':
				stdout.write(str(i + 1) + ' ')
				tsol -= 1
				if tsol == 0:
					break
		tsol = sol
		tarr = []
		for i in range(len(s) - 1, ansind - 1, -1):
			if s[i] == ')':
				tarr.append(str(i + 1) + ' ')
				tsol -= 1
				if tsol == 0:
					break
		for i in tarr[::-1]:
			stdout.write(i)
		stdout.write('\n')
	else:
		stdout.write('0\n')


s = input()
l = 0
r = s.count(')')
result = []
for (i, c) in enumerate(s):
	if c == '(':
		if l < r:
			result.append(i + 1)
		l += 1
	else:
		if l >= r:
			result.append(i + 1)
		r -= 1
if len(result) > 0:
	print(1)
	print(len(result))
	print(*result)
else:
	print(0)


def main():
	s = input()
	openList = []
	closeList = []
	for i in range(len(s)):
		if s[i] == '(':
			openList.append(i + 1)
		else:
			closeList.append(i + 1)
	outputQueue = []
	count = 0
	itemCount = 0
	openIndex = 0
	for i in range(len(closeList)):
		v = closeList.pop()
		if openIndex < len(openList) and openList[openIndex] < v:
			count = 1
			itemCount += 2
			outputQueue.append(openList[openIndex])
			outputQueue.append(v)
			openIndex += 1
		else:
			break
	print(count)
	if count > 0:
		print(itemCount)
	outputQueue.sort()
	for x in outputQueue:
		print(x, end=' ')
main()


s = input()
op = []
clo = []
for i in range(len(s)):
	if s[i] == '(':
		op.append(i + 1)
	else:
		clo.append(i + 1)
j = 0
while j < min(len(op), len(clo)):
	if op[j] < clo[len(clo) - 1 - j]:
		j += 1
	else:
		break
if j != 0:
	print(1)
print(j * 2)
for i in range(j):
	print(op[i], end=' ')
for i in range(-j, 0):
	print(clo[i], end=' ')


from sys import stdin, stdout
from collections import deque
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def LSS(s):
	s = list(s)
	lss = 0
	(numO, numC) = ([0 for _ in range(len(s))], [0 for _ in range(len(s))])
	for (i, c) in enumerate(s):
		if i == 0:
			numO[0] = 1 if c == '(' else 0
			continue
		numO[i] = numO[i - 1] + (1 if c == '(' else 0)
	for i in range(len(s) - 1, -1, -1):
		c = s[i]
		if i == len(s) - 1:
			numC[i] = 1 if c == ')' else 0
			continue
		numC[i] = numC[i + 1] + (1 if c == ')' else 0)
	for (a, b) in zip(numO, numC):
		lss = max(lss, 2 * min(a, b))
	return lss

def main():
	s = rll()[0]
	torem = LSS(s)
	moveseq = []
	ans = 0
	while torem > 0:
		ans += 1
		(movesf, movesb) = ([], deque())
		for (i, c) in enumerate(s):
			if c == '(':
				movesf.append(i + 1)
			if len(movesf) == torem // 2:
				break
		for i in range(len(s) - 1, -1, -1):
			c = s[i]
			if c == ')':
				movesb.appendleft(i + 1)
			if len(movesb) == torem // 2:
				break
		movesf.extend(movesb)
		moveset = set(movesf)
		moveseq.append(movesf)
		s = ''.join((s[i] for i in range(len(s)) if i + 1 not in moveset))
		torem = LSS(s)
	stdout.write(str(ans))
	stdout.write('\n')
	for m in moveseq:
		stdout.write(str(len(m)))
		stdout.write('\n')
		stdout.write(str(' '.join((str(x) for x in m))))
		stdout.write('\n')
	stdout.close()
main()


s = input()
start = 0
end = len(s) - 1
ans = []
while end > start:
	while s[start] != '(' and end > start:
		start += 1
	while s[end] != ')' and end > start:
		end -= 1
	if s[start] == '(' and s[end] == ')':
		ans.append(start + 1)
		ans.append(end + 1)
	start += 1
	end -= 1
ans.sort()
if len(ans) != 0:
	print('1')
	print(len(ans))
	for i in ans:
		print(i, end=' ')
else:
	print('0')


s = input().strip()
n = len(s)
(i, j) = (0, len(s) - 1)
(left, right) = ([], [])
while i < j:
	while i < j and s[i] == ')':
		i += 1
	while i < j and s[j] == '(':
		j -= 1
	if i < j:
		left.append(i + 1)
		right.append(j + 1)
		i += 1
		j -= 1
if len(left) > 0:
	print(1)
	print(len(left) + len(right))
	print(' '.join(map(str, left + list(reversed(right)))))
else:
	print(0)


def main():
	s = list(input())
	left = 0
	right = 0
	for i in s:
		if i == '(':
			left += 1
		else:
			right += 1
	best_len = 0
	best_index = None
	current_left = 0
	current_right = 0
	for (index, el) in enumerate(s):
		if el == '(':
			current_left += 1
		else:
			current_right += 1
		cur_len = min(current_left, right - current_right)
		if cur_len > best_len:
			best_len = cur_len
			best_index = index
	if best_index is None:
		print(0)
		return
	answer = []
	need_left = best_len
	need_right = best_len
	for (index, el) in enumerate(s):
		if index <= best_index and el == '(' and need_left:
			answer.append(index + 1)
			need_left -= 1
	for index in range(len(s) - 1, -1, -1):
		el = s[index]
		if index >= best_index and el == ')' and need_right:
			answer.append(index + 1)
			need_right -= 1
	answer.sort()
	print(1)
	print(len(answer))
	print(*answer)
main()


s = input()
i = 0
j = len(s) - 1
res = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		res.append(i + 1)
		res.append(j + 1)
		i += 1
		j -= 1
	if s[i] == ')':
		i += 1
	if s[j] == '(':
		j -= 1
res.sort()
if len(res):
	print(1)
	print(len(res))
	print(' '.join([str(x) for x in res]))
else:
	print(0)


string = input()
(p, q) = ([], [])
n = len(string)
for i in range(n):
	if string[i] == '(':
		p.append(i)
	else:
		q.append(i)
m = min(len(p), len(q))
q.reverse()
answer = []
for i in range(m):
	if p[i] < q[i]:
		answer.append(p[i])
		answer.append(q[i])
	else:
		break
answer.sort()
if answer == []:
	print('0')
else:
	print('1')
	print(len(answer))
	for a in answer:
		print(a + 1, end=' ')


s = input()
ans = []
(i, j) = (0, len(s) - 1)
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			ans.extend([i + 1, j + 1])
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
if ans:
	print(1)
	print(len(ans))
	print(*sorted(ans))
else:
	print(0)


a = list(input())
n = len(a)
ans = list()
(l, r) = (0, len(a) - 1)
while l < r:
	while l < n and a[l] == ')':
		l += 1
	while r > 0 and a[r] == '(':
		r -= 1
	if not l < r:
		break
	ans.extend([l, r])
	l += 1
	r -= 1
ops = len(ans)
if ops != 0:
	print(1)
	print(ops)
	print(' '.join(map(lambda x: str(x + 1), sorted(ans))))
else:
	print(0)


S = input()
N = len(S)
(L, R) = ([], [])
(l, r) = (0, N - 1)
while r > l:
	while S[l] == ')':
		l += 1
		if l >= N:
			break
	while S[r] == '(':
		r -= 1
		if r < 0:
			break
	if r > l:
		L.append(l + 1)
		R.append(r + 1)
		l += 1
		r -= 1
if len(L) == 0:
	print(0)
else:
	print(1)
	print(len(L) * 2)
	print(*L + R[::-1])


S = list(input())
cnt = 0
ans = []
while True:
	li = 0
	ri = len(S) - 1
	now = []
	able = [True] * len(S)
	while True:
		while li < len(S) and S[li] != '(':
			li += 1
		while ri >= 0 and S[ri] != ')':
			ri -= 1
		if li < ri:
			now.append(li + 1)
			now.append(ri + 1)
			able[li] = False
			able[ri] = False
			li += 1
			ri -= 1
		else:
			break
	if len(now) == 0:
		break
	else:
		cnt += 1
		now.sort()
		ans.append(now)
		ns = []
		for i in range(len(S)):
			if able[i]:
				ns.append(S[i])
		S = ns
print(len(ans))
for i in ans:
	print(len(i))
	print(' '.join(map(str, i)))


import sys
from os import path
if path.exists('input.txt') and path.exists('output.txt'):
	sys.stdout = open('output.txt', 'w')
	sys.stdin = open('input.txt', 'r')

def main():
	s = input()
	n = len(s)
	(l, r) = (0, n - 1)
	(left, right) = ([], [])
	while l < r:
		while l < r and s[l] == ')':
			l += 1
		while l < r and s[r] == '(':
			r -= 1
		if l < r and s[l] == '(' and (s[r] == ')'):
			left.append(l + 1)
			right.append(r + 1)
		l += 1
		r -= 1
	if not left:
		print(0)
	else:
		print(f'1\n{2 * len(left)}')
		for l in left:
			print(l, end=' ')
		for r in reversed(right):
			print(r, end=' ')
main()


from collections import deque
s = input()
left = deque()
right = deque()
for i in range(len(s)):
	if s[i] == '(':
		left.append(i)
	else:
		right.append(i)
(arr1, arr2) = ([], [])
flag = 0
while left and right:
	if left[0] < right[-1]:
		arr1.append(left.popleft() + 1)
		arr2.append(right.pop() + 1)
		flag = 1
	else:
		break
arr2.reverse()
arr3 = arr1 + arr2
if flag:
	print(flag)
	print(len(arr3))
	print(*arr3)
else:
	print(0)


s = input()
(l, c, b) = ([], 0, len(s))
for i in range(len(s)):
	a = s[:b].rfind(')')
	if s[i] == '(' and a > -1 and (a > i):
		c += 1
		l.append(i + 1)
		l.append(a + 1)
		b = a
if c > 0:
	print(1)
print(c * 2)
l.sort()
for i in l:
	print(i, end=' ')


x = input()
s = [str(i) for i in x]
i = 0
j = len(s) - 1
res = []
c = 0
while True:
	ans = []
	i = 0
	j = len(s) - 1
	while i < j:
		if s[i] == '(' and s[j] == ')':
			ans += [i + 1, j + 1]
			s[i] = '-'
			s[j] = '-'
			i += 1
			j -= 1
		elif s[i] == ')' and s[j] == '(':
			i += 1
			j -= 1
		elif s[i] == '(' and s[j] == '(':
			j -= 1
		elif s[i] == ')' and s[j] == ')':
			i += 1
		elif s[i] == '-' and s[j] == ')':
			i += 1
		elif s[i] == '(' and s[j] == '-':
			j -= 1
		else:
			i += 1
			j -= 1
	if len(ans) == 0:
		break
	else:
		res += ans
		c += 1
if c == 0:
	print(c)
else:
	print(c)
	print(len(res))
	res.sort()
	print(*res)


def min_opr(s):
	min_oprs = 0
	output = []
	op = True
	while op:
		op = False
		to_remove = set()
		a = 0
		b = len(s) - 1
		while a < b:
			if s[a] == '(':
				while s[b] != ')' and b > 0:
					b -= 1
				if a < b:
					to_remove.add(a)
					to_remove.add(b)
				b -= 1
			a += 1
		if len(to_remove) > 0:
			op = True
			output.append((len(to_remove), [str(i + 1) for i in sorted(list(to_remove))]))
			s = ''.join([c for (i, c) in enumerate(s) if i not in to_remove])
			min_oprs += 1
	return output

def solve():
	s = input().strip()
	result = min_opr(s)
	print(len(result))
	for r in result:
		print(r[0])
		print(*r[1])
solve()


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
s = inputstring()
start = 0
end = len(s)
rtn1 = []
rtn2 = []
while start < end - 1:
	if s[start] == '(':
		for j in reversed(range(start + 1, end)):
			if s[j] == ')':
				rtn1.append(start + 1)
				rtn2.append(j + 1)
				end = j
				break
	start += 1
n = len(rtn1)
if n == 0:
	print(0)
else:
	print(1)
	print(2 * n)
	for i in range(n):
		print(rtn1[i], end=' ')
	for i in reversed(range(n)):
		print(rtn2[i], end=' ')


import os
import sys
from io import BytesIO, IOBase

def solution(s):
	n = len(s)
	(i, j) = (0, n - 1)
	res = []
	while i < j:
		if s[i] == '(' and s[j] == ')':
			res.extend([i + 1, j + 1])
			i += 1
			j -= 1
		elif s[i] == '(' and s[j] == '(':
			j -= 1
		elif s[i] == ')' and s[j] == ')':
			i += 1
		else:
			i += 1
			j -= 1
	res.sort()
	if res:
		write(1)
		write(len(res))
		write(*res)
	else:
		write(0)

def main():
	s = input()
	solution(s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def w_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


s = input()
ls = [x for x in s]
l = []
x = 0
n = len(ls)
y = n - 1
while 1:
	while x < n and ls[x] != '(':
		x += 1
	while y >= 0 and ls[y] != ')':
		y -= 1
	if x < y:
		l.append(x + 1)
		l.append(y + 1)
		x += 1
		y -= 1
	else:
		break
print(min(1, len(l)))
if len(l) != 0:
	print(len(l))
	l.sort()
	for i in l:
		print(i, end=' ')


s = input().strip()
n = len(s)
(i, j) = (0, n)
ls = []
rs = []
for i in range(n):
	if i >= j:
		break
	if s[i] != '(':
		continue
	while i < j:
		j -= 1
		if s[j] != ')':
			continue
		break
	if i >= j:
		break
	ls.append(i + 1)
	rs.append(j + 1)
R = ls + rs[::-1]
if len(R) == 0:
	print(0)
else:
	print(1)
	print(len(R))
	print(*R)


s = input()
i = 0
j = len(s) - 1
l = []
while i < j:
	if s[j] == ')':
		if s[i] == '(':
			l.append(i + 1)
			l.append(j + 1)
			i += 1
			j -= 1
		else:
			i += 1
	else:
		j -= 1
if len(l) == 0:
	print(0)
else:
	print(1)
	print(len(l))
	l.sort()
	print(*l)


l = list(input())
left = 0
right = len(l) - 1
ans = 0
index = []
while left < right:
	while left < right and l[left] != '(':
		left += 1
	while right > left and l[right] != ')':
		right -= 1
	if l[left] == '(' and l[right] == ')':
		ans += 1
		index.extend([left + 1, right + 1])
		left += 1
		right -= 1
	else:
		break
if index:
	print(1)
	print(ans * 2)
	index.sort()
	print(*index)
else:
	print(0)


def calc(a):
	n = len(a)
	j = n - 1
	i = 0
	left = []
	right = []
	while i < j:
		while i < n and a[i] != '(':
			i += 1
		while j >= 0 and a[j] != ')':
			j -= 1
		if i < j:
			left += [i + 1]
			right.insert(0, j + 1)
			i += 1
			j -= 1
	return left + right
s = input()
c = 1
ans = calc(s)
if len(ans) == 0:
	print(0)
else:
	print(c)
	print(len(ans))
	for i in ans:
		print(i, end=' ')


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
s = input()
l = []
d = []
for i in range(len(s)):
	if s[i] == '(':
		l.append(i + 1)
	else:
		d.append(i + 1)
d.sort(reverse=True)
l1 = []
for i in range(min(len(l), len(d))):
	if l[i] < d[i]:
		l1 += [l[i], d[i]]
if len(l1) == 0:
	print(0)
else:
	print(1)
	print(len(l1))
	l1.sort()
	print(*l1)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
import datetime
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		s = input()
		l = 0
		r = len(s) - 1
		a = []
		while True:
			t = 0
			for i in range(l, r):
				if s[i] == '(':
					l = i
					t = 1
					break
			if t == 0:
				break
			for i in range(r, l, -1):
				if s[i] == ')':
					r = i
					a.append(l + 1)
					a.append(r + 1)
					t = 1
					break
			if t == 0:
				break
			else:
				l += 1
				r -= 1
		if len(a):
			print(1)
		print(len(a))
		if len(a):
			print(*sorted(a))
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


word = list(input())
indices = list()
for i in range(len(word)):
	if word[i] == '(' or i == len(word) - 1:
		for j in range(len(word) - 1, i, -1):
			if word[j] == ')':
				indices.append(i)
				indices.append(j)
				word[i] = -1
				word[j] = -1
				if j != i + 1:
					break
		else:
			indices = [x + 1 for x in indices]
			indices.sort()
			if len(indices) == 0:
				print(0)
				exit()
			else:
				print(1)
				print(len(indices))
				print(*indices)
				exit()
			break


s = input()
n = len(s)
vopen = []
vclose = []
ans = []
for i in range(len(s)):
	if s[i] == '(':
		vopen.append(i + 1)
	if s[i] == ')':
		vclose.append(i + 1)
i = 0
j = len(vclose) - 1
while 1:
	if i >= len(vopen) or j < 0 or vopen[i] > vclose[j]:
		break
	ans.append(vopen[i])
	ans.append(vclose[j])
	i += 1
	j -= 1
if len(ans) == 0:
	print(0)
else:
	ans.sort()
	print(1)
	print(len(ans))
	for i in ans:
		print(i, end=' ')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
s = input()
n = len(s)
(i, j) = (0, n - 1)
ans = []
while True:
	n = len(s)
	cur = ''
	back = ''
	(i, j) = (0, n - 1)
	res = []
	while i < j:
		while i < n and s[i] == ')':
			cur += s[i]
			i += 1
		while j >= 0 and s[j] == '(':
			j -= 1
			back = '(' + back
		if i < j:
			res.append(i + 1)
			res.append(j + 1 - len(ans))
		i += 1
		j -= 1
	if not res:
		break
	ans.append(res)
	s = cur + back
print(len(ans))
for i in ans:
	print(len(i))
	print(*sorted(i))


s = input()
(l, r) = (0, len(s) - 1)
val = []
while l < r:
	while l < len(s) and s[l] != '(':
		l += 1
	while r > 0 and s[r] != ')':
		r -= 1
	if l >= r:
		break
	val.append(l + 1)
	val.append(r + 1)
	l += 1
	r -= 1
if len(val):
	print(1)
	print(len(val))
	val.sort()
	print(*val)
else:
	print(0)


s = list(input())
ops_done = True
ops = []
while ops_done:
	ops_done = False
	(l, r) = (0, len(s) - 1)
	indices = []
	l_found = False
	r_found = False
	while l < r:
		if not l_found:
			if s[l] == '(':
				l_found = True
			else:
				l += 1
		elif not r_found:
			if s[r] == ')':
				r_found = True
			else:
				r -= 1
		if l_found and r_found:
			ops_done = True
			indices += [l + 1, r + 1]
			l_found = False
			r_found = False
			l += 1
			r -= 1
	indices.sort()
	for i in range(len(indices) - 1, -1, -1):
		s.pop(indices[i] - 1)
	if ops_done:
		ops.append(indices)
print(len(ops))
for op in ops:
	print(len(op))
	print(*op)


s = input().strip()
si = 0
li = len(s) - 1
ops = []
idss = []
idsk = []
si = 0
li = len(s) - 1
for (i, a) in enumerate(s):
	if a == '(':
		idss.append(i)
	else:
		idsk.append(i)
pa = []
pb = []
for (a, b) in zip(idss, reversed(idsk)):
	if a < b:
		pa.append(a)
		pb.append(b)
	else:
		break
if len(pa) == 0:
	print(0)
	exit(0)
print(1)
print(2 * len(pa))
print(' '.join(map(lambda z: str(z + 1), pa + list(reversed(pb)))))


s = input()
n = len(s)
l = []
r = []
for i in range(n):
	if s[i] == '(':
		l.append(i + 1)
	else:
		r.append(i + 1)
ans = 0
for i in range(min(len(l), len(r))):
	if l[i] < r[-i - 1]:
		ans += 1
	else:
		break
if ans:
	print(1)
	print(ans * 2)
	print(*l[:ans], *r[-ans:])
else:
	print(0)


s = list(input())
(i, j) = (0, len(s) - 1)
ans = []
t = 0
if s == ['(', ')']:
	print(1)
	print(2)
	print(1, 2)
else:
	while i < j - 1:
		while s[i] != '(':
			if i + 1 < j:
				i += 1
			else:
				t = 1
				break
		if t:
			break
		while s[j] != ')':
			if i + 1 < j:
				j -= 1
			else:
				t = 1
				break
		if t:
			break
		ans.append(i + 1)
		ans.append(j + 1)
		s[i] = s[j] = 0
	if ans:
		print(1)
		print(len(ans))
		print(*sorted(ans))
	else:
		print(0)


s = input()
n = len(s)
i = 0
j = n - 1
l = []
while i < j:
	if s[i] == '(':
		if s[j] == ')':
			l.append(i + 1)
			l.append(j + 1)
			i += 1
			j -= 1
		else:
			j -= 1
	else:
		i += 1
l.sort()
x = len(l)
if len(l) > 0:
	print('1')
	print(x)
	for i in l:
		print(i, end=' ')
	print('\n')
else:
	print('0')


brack = []
brack = list(input())
sz = len(brack)
num = [i for i in range(sz)]
ans = []
while True:
	sz = len(brack)
	if sz == 0:
		break
	prefix = [0] * sz
	suffix = [0] * sz
	visit = [0] * sz
	if brack[0] == '(':
		prefix[0] = 1
	if brack[sz - 1] == ')':
		suffix[sz - 1] = 1
	for i in range(1, sz):
		prefix[i] = prefix[i - 1]
		suffix[sz - 1 - i] = suffix[sz - i]
		if brack[i] == '(':
			prefix[i] += 1
		if brack[sz - 1 - i] == ')':
			suffix[sz - 1 - i] += 1
	simple = 0
	for i in range(sz - 1):
		if suffix[i + 1] >= prefix[i]:
			simple = prefix[i]
	if simple == 0:
		break
	tempList = []
	cntr = 0
	for i in range(sz):
		if cntr < simple:
			if brack[i] == '(':
				cntr += 1
				visit[i] = True
		else:
			break
	cntr = 0
	for i in range(sz):
		if cntr < simple:
			if brack[sz - 1 - i] == ')':
				cntr += 1
				visit[sz - 1 - i] = True
		else:
			break
	for i in range(sz):
		if visit[sz - 1 - i] == True:
			tempList.append(num[sz - 1 - i])
			num.pop(sz - 1 - i)
			brack.pop(sz - 1 - i)
	tempList.reverse()
	ans.append(tempList)
print(len(ans))
for x in ans:
	print(len(x))
	for i in range(len(x)):
		print(x[i] + 1, end=' ')
	print()


from sys import stdin

def main():
	readline = stdin.readline
	s = readline().strip()
	count = 0
	count_left = [0] * (len(s) + 2)
	count_right = [0] * (len(s) + 2)
	max_count = 0
	for i in range(len(s) + 2):
		if i == 0:
			continue
		if i == len(s) + 1:
			count_left[i] = count_left[i - 1]
			break
		if s[i - 1] == '(':
			count += 1
			count_left[i] = count
		elif s[i - 1] == ')':
			count_left[i] = count
	count = 0
	for i in range(len(s) + 2):
		i = len(s) + 1 - i
		if i == len(s) + 1:
			continue
		if i == 0:
			count_right[i] = count_right[i + 1]
			break
		if s[i - 1] == ')':
			count += 1
			count_right[i] = count
		elif s[i - 1] == '(':
			count_right[i] = count
	for i in range(len(count_left)):
		max_count = max(max_count, min(count_left[i], count_right[i]))
	left = max_count
	right = max_count
	result = []
	i = 0
	while left > 0:
		if s[i] == '(':
			left -= 1
			result.append(i + 1)
		i += 1
	i = len(s) - 1
	while right > 0:
		if s[i] == ')':
			right -= 1
			result.append(i + 1)
		i -= 1
	result.sort()
	if len(result) > 0:
		print(1)
		print(len(result))
		print(*result)
	else:
		print(0)
main()


def main():
	data = list(input())
	flag = True
	result = []
	counter = 0
	while len(data) > 0:
		left_list = []
		right_list = []
		delete_list = []
		for (i, el) in enumerate(data):
			if el == '(':
				left_list.append(i)
		for (i, el) in enumerate(reversed(data)):
			if el == ')':
				right_list.append(len(data) - i - 1)
		for i in range(min(len(right_list), len(left_list))):
			if left_list[i] < right_list[i]:
				delete_list.append(left_list[i])
				delete_list.append(right_list[i])
			else:
				break
		if len(delete_list) > 0:
			delete_list.sort()
			result.append([i + 1 for i in delete_list])
			counter += 1
			data = [i for (j, i) in enumerate(data) if j not in delete_list]
		else:
			break
	print(counter)
	for step in result:
		print(len(step))
		print(' '.join(map(str, step)))
main()


import sys
s = input()
a = list(s)
if '(' not in a or ')' not in a:
	print(0)
	sys.exit()
pos = a.index('(')
pos1 = len(a) - a[::-1].index(')') - 1
b = []
t = 0
while pos < pos1:
	if '(' not in a or ')' not in a:
		break
	pos = a.index('(')
	pos1 = len(a) - a[::-1].index(')') - 1
	b.append(pos + 1 + t)
	b.append(pos1 + 1 + t)
	t += 1
	a.pop(pos)
	a.pop(pos1 - 1)
	if '(' not in a or ')' not in a:
		break
	pos = a.index('(')
	pos1 = len(a) - a[::-1].index(')') - 1
if len(b) == 0:
	print(0)
else:
	print(1)
	print(len(b))
	b.sort()
	print(*b, sep=' ')


s = list(input())
actions = []
while True:
	ls = len(s)
	(i, j) = (0, ls - 1)
	rm = set()
	while i < ls and s[i] != '(':
		i += 1
	while j >= 0 and s[j] != ')':
		j -= 1
	while i < j:
		rm.add(i + 1)
		rm.add(j + 1)
		i += 1
		j -= 1
		while i < ls and s[i] != '(':
			i += 1
		while j >= 0 and s[j] != ')':
			j -= 1
	if rm:
		actions.append(sorted(rm))
		s = [s for (i, s) in enumerate(s) if i + 1 not in rm]
	else:
		break
print(len(actions))
print('\n'.join((str(len(rm)) + '\n' + ' '.join(list(map(str, rm))) for rm in actions)))


for _ in range(1):
	s = input()
	d = []
	e = []
	z = 0
	for i in range(len(s)):
		if s[i] == '(':
			d.append(i + 1)
		else:
			e.append(i + 1)
	k = len(d)
	l = len(e)
	e = e[::-1]
	if k == 0 or l == 0:
		print(0)
	else:
		ans = []
		for i in range(min(l, k)):
			if d[i] > e[i]:
				break
			else:
				z += 2
				ans.append(d[i])
				ans.append(e[i])
		if z == -1:
			p = 0
		elif z == 0:
			print(0)
		else:
			print(1)
			print(z)
			print(*sorted(ans))


s = input()
l = 0
r = len(s) - 1
a = []
while l < r:
	while l < len(s) and s[l] != '(':
		l += 1
	while r >= 0 and s[r] != ')':
		r -= 1
	if l < r:
		a.append(l + 1)
		a.append(r + 1)
		l += 1
		r -= 1
if len(a) == 0:
	print(0)
else:
	a.sort()
	print(1)
	print(len(a))
	print(' '.join(map(str, a)))


s = input()
a = list(s)
i = 0
j = len(s) - 1
ans = []
while i < j:
	if a[i] == '(' and a[j] == ')':
		ans.append(i + 1)
		ans.append(j + 1)
		i += 1
		j -= 1
	elif a[i] == '(' and a[j] == '(':
		j -= 1
	elif a[i] == ')' and a[j] == ')':
		i += 1
	else:
		i += 1
		j -= 1
ans.sort()
if len(ans) > 0:
	print(1)
	print(len(ans))
	for i in ans:
		print(i, end=' ')
	print()
else:
	print(0)


import math, collections, sys
s = input()
o = collections.deque([])
c = collections.deque([])
for i in range(len(s)):
	if s[i] == '(':
		o.append(i + 1)
	else:
		c.append(i + 1)
ans = []
while o and c:
	if o[0] < c[-1]:
		ans.append(o.popleft())
		ans.append(c.pop())
	else:
		break
ans.sort()
if len(ans):
	print(1)
	print(len(ans))
	print(*ans)
else:
	print(0)


s = input()
ans = 0
Ans = []
i = 0
j = len(s) - 1
while i - j < 0:
	if s[i] == '(' and s[j] == ')':
		ans += 1
		Ans.append(i + 1)
		Ans.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == '(':
		j -= 1
	elif s[j] == ')':
		i += 1
	else:
		i += 1
		j -= 1
Ans.sort()
if ans != 0:
	print(1)
	print(ans * 2)
	print(*Ans)
else:
	print(0)


s = input()
(open, close) = ([], [])
i = 0
for i in range(len(s)):
	if s[i] == '(':
		open.append(i)
	else:
		close.append(i)
(i, j) = (0, len(close) - 1)
ans = []
while i < len(open) and j >= 0 and (open[i] < close[j]):
	ans += [open[i] + 1, close[j] + 1]
	i += 1
	j -= 1
ans.sort()
print('0' if not ans else '1\n{}\n{}'.format(len(ans), ' '.join([str(idx) for idx in ans])))


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
s = ins()
n = len(s)
l = 0
r = n - 1
ans = []
while l < r:
	while l < n and s[l] == ')':
		l += 1
	while r >= 0 and s[r] == '(':
		r -= 1
	if l < r:
		ans.append(l)
		ans.append(r)
		l += 1
		r -= 1
if len(ans) == 0:
	print(0)
	exit()
ans.sort()
print(1)
print(len(ans))
pad = ''
for z in ans:
	printn(pad + str(z + 1))
	pad = ' '
print('')


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
S = input()
N = len(S)
i = 0
j = N - 1
ans = []
while 1:
	while i < N and S[i] != '(':
		i += 1
	while j >= 0 and S[j] != ')':
		j -= 1
	if i >= j:
		break
	ans.append(i + 1)
	ans.append(j + 1)
	i += 1
	j -= 1
ans.sort()
if not ans:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*ans)


s = input()
i = -1
j = len(s)
ans_i = []
ans_j = []
ki = 0
kj = 0
while j > i + 1:
	if ki > kj:
		j -= 1
		if s[j] == ')':
			kj += 1
			ans_j.append(j + 1)
	else:
		i += 1
		if s[i] == '(':
			ki += 1
			ans_i.append(i + 1)
if ki > kj:
	ans_i.pop()
ans = ans_i + ans_j[::-1]
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(' '.join(map(str, ans)))


s = input()
operations = []
while True:
	i = 0
	j = len(s) - 1
	left = []
	right = []
	while i < j:
		while i < len(s) and s[i] != '(':
			i += 1
		while j >= 0 and s[j] != ')':
			j -= 1
		if i < j:
			left.append(i)
			right.append(j)
		i += 1
		j -= 1
	if not left:
		break
	rmi = set(left + right)
	s = ''.join((ch for (i, ch) in enumerate(s) if i not in rmi))
	operations = []
	operations.append(left + right[::-1])
print(len(operations))
for op in operations:
	print(len(op))
	print(*[v + 1 for v in op])


s = input()
o = []
c = []
for i in range(len(s)):
	if s[i] == '(':
		o.append(i + 1)
	else:
		c.append(i + 1)
o.reverse()
ans = []
while o and c and (o[-1] < c[-1]):
	ans.append(o.pop())
	ans.append(c.pop())
ans.sort()
m = len(ans)
if m:
	print(1)
	print(m)
	print(' '.join([str(x) for x in ans]))
else:
	print(0)


from math import *
from collections import *
from functools import *
from bisect import *
from itertools import *
from heapq import *
from statistics import *
inf = float('inf')
ninf = -float('inf')
ip = input
alphal = 'abcdefghijklmnopqrstuvwxyz'
alphau = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def ipl():
	return list(map(int, ip().split()))

def ipn():
	return int(ip())

def ipf():
	return float(ip())

def solve():
	s = ip()
	n = len(s)
	(i, j) = (0, n - 1)
	lb = [i for (i, e) in enumerate(s) if e == '(']
	rb = [i for (i, e) in enumerate(s) if e == ')']
	r = []
	for i in range(min(len(lb), len(rb))):
		if lb[i] < rb[-i - 1]:
			r.append(lb[i] + 1)
			r.append(rb[-i - 1] + 1)
	if r:
		print(1)
		print(len(r))
		for i in sorted(r):
			print(i, end=' ')
		return
	print(0)
t = 1
for _ in range(t):
	solve()


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	s = list(input())
	n = len(s)
	(c1, c2) = ([], [])
	for (j, i) in enumerate(s):
		if i == '(':
			c1.append(j + 1)
		else:
			c2.append(j + 1)
	ans = [0, []]
	ch = 1
	for i in c1:
		ch1 = 0
		x = i
		ch2 = []
		for j in c2:
			if j > x:
				ch2.append(j)
				ch1 += 1
		x = min(ch, ch1)
		if x > ans[0]:
			ans[0] = x
			ans[1] = c1[:x] + ch2[-x:]
		ch += 1
	if ans[0] == 0:
		print(0)
	else:
		print(1)
		print(len(ans[1]))
		print(*sorted(ans[1]))
main()


ar = list(input())
fin_ans = 0
flag = 0
fin_kek = []
while flag == 0:
	a = 0
	b = ar.count(')')
	kek = []
	for i in range(len(ar)):
		if ar[i] == '(':
			a += 1
			if b >= a:
				kek.append(i + 1)
		else:
			b -= 1
	fin_ans += 1
	fin_kek.append(kek)
	if len(kek) == 0:
		flag = 1
	if len(kek) > 0:
		num = kek[-1]
		uaua = len(kek)
		ahah = 0
		for j in range(len(ar) - 1, num - 1, -1):
			if ar[j] == ')' and ahah < uaua:
				kek.append(j + 1)
				ahah += 1
	lol = []
	for j in range(len(ar)):
		if j + 1 not in kek:
			lol.append(ar[j])
	ar = lol.copy()
print(fin_ans - 1)
fin_kek.pop()
for elem in fin_kek:
	print(len(elem))
	elem.sort()
	print(*elem)


arr = input()
right = []
left = []
crr = []
for i in range(len(arr)):
	if arr[i] == '(':
		right.append(i)
	else:
		left.append(i)
if len(right) == 0 or len(left) == 0:
	print(0)
else:
	while len(right) > 0 and len(left) > 0 and (min(right) < max(left)):
		crr.append(right[0])
		right.pop(0)
		crr.append(left[len(left) - 1])
		left.pop(len(left) - 1)
	crr.sort()
	res = list(map(str, [x + 1 for x in crr]))
	if len(res) > 0:
		print(1)
	print(len(res))
	print(' '.join(res))


s = input()
i = 0
j = len(s)
r = []
while i != j:
	ii = 0
	jj = 0
	while i < len(s) and i != j:
		if s[i] != '(':
			i += 1
		else:
			ii = i + 1
			i += 1
			break
	while j > 0 and i != j:
		if s[j - 1] != ')':
			j -= 1
		else:
			jj = j
			j -= 1
			break
	if ii > 0 and jj > 0:
		r.append(ii)
		r.append(jj)
if len(r) > 0:
	print(1)
	print(len(r))
	print(*sorted(r))
else:
	print(0)


s = input()
i = 0
n = len(s)
j = n - 1
l = []
while i < n and j >= 0:
	ind = -1
	indd = -1
	while i < j:
		if s[i] == '(':
			ind = i
			break
		i += 1
	while j > i:
		if s[j] == ')':
			indd = j
			break
		j -= 1
	if ind != -1 and indd != -1:
		l.append(ind + 1)
		l.append(indd + 1)
		i += 1
		j -= 1
	else:
		break
if len(l) == 0:
	print(0)
else:
	print(1)
	print(len(l))
	l.sort()
	print(*l)


string = input()
l = 0
r = len(string) - 1
indices = []
while l < r:
	while string[l] == '(' and string[r] == ')':
		didOp = True
		indices.extend([l + 1, r + 1])
		l += 1
		r -= 1
	if string[l] != '(':
		l += 1
	if string[r] != ')':
		r -= 1
if indices:
	print(1)
	print(len(indices))
	print(*sorted(indices))
else:
	print(0)


a = input()
(ans, ans1) = ([], [])
(q1, q2) = (0, len(a) - 1)
while True:
	while q1 < len(a) and a[q1] == ')':
		q1 += 1
	while q2 > -1 and a[q2] == '(':
		q2 -= 1
	if q1 < q2:
		ans.append(q1 + 1)
		ans1.append(q2 + 1)
	else:
		break
	q1 += 1
	q2 -= 1
if len(ans) + len(ans1) == 0:
	print(0)
else:
	print(1)
	print(len(ans) + len(ans1))
	print(*ans, *ans1[::-1])


s = input()
d = {'(': [], ')': []}
for i in range(len(s)):
	d[s[i]].append(i)
l = d['(']
z = d[')']
if len(d['(']) < len(d[')']):
	x = len(d['('])
else:
	x = len(d[')'])
f = []
k = 0
for i in range(x):
	if l[i] < z[len(z) - 1 - i]:
		k = 1
		f.extend([l[i] + 1, z[len(z) - 1 - i] + 1])
	else:
		break
if k != 0:
	print(k)
	print(len(f))
	f.sort()
	print(' '.join(list(map(str, f))))
else:
	print(0)


import copy

def find_cut(s):
	n = len(s)
	i = 0
	j = n - 1
	start_indices = []
	end_indices = []
	while i < j:
		if s[i] == '(':
			if s[j] == ')':
				start_indices.append(i)
				end_indices.append(j)
				i += 1
				j -= 1
			else:
				j -= 1
		else:
			i += 1
	s2 = []
	indices_to_remove = set()
	for i in range(len(start_indices)):
		indices_to_remove.add(start_indices[i])
	for i in range(len(end_indices) - 1, -1, -1):
		indices_to_remove.add(end_indices[i])
	k = 0
	for i in range(n):
		if i not in indices_to_remove:
			s2.append(s[i])
	return (s2, list(indices_to_remove))
s = list(input())
(s, indices_to_remove) = find_cut(s)
operations = 0
index_list_to_remove = []
while len(indices_to_remove) > 0:
	operations += 1
	index_list_to_remove.append(indices_to_remove)
	(s, indices_to_remove) = find_cut(s)
print(operations)
for indices_to_remove in index_list_to_remove:
	print(len(indices_to_remove))
	indices_to_remove.sort()
	for i in range(len(indices_to_remove)):
		print(str(indices_to_remove[i] + 1), end=' ')
	print()


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)
debugging = 1
s = list(input())
cnt = 0
answers = []
while True:
	left = -1
	right = len(s)
	lcnt = 0
	rcnt = 0
	to_rem = []
	while left < right and left < len(s) - 1 and (right > 0):
		if lcnt <= rcnt:
			left += 1
			if s[left] == '(':
				to_rem.append(left)
				lcnt += 1
		else:
			right -= 1
			if s[right] == ')':
				to_rem.append(right)
				rcnt += 1
	if lcnt > rcnt and to_rem:
		to_rem.pop()
	if not to_rem:
		break
	else:
		cnt += 1
		to_rem.sort()
		for x in to_rem[::-1]:
			del s[x]
		answers.append(to_rem)
print(cnt)
for a in answers:
	print(len(a))
	print(' '.join([str(x + 1) for x in a]))


s = list(input())
back = len(s) - 1
while back >= 0 and s[back] != ')':
	back -= 1
front = 0
while front < len(s) and s[front] != '(':
	front += 1
ans = []
i = 0
while len(s) != 0:
	bf = []
	bb = []
	while front <= back:
		if s[front] == '(':
			bf.append(front)
		if s[back] == ')':
			bb.append(back)
		front += 1
		back -= 1
		while front < len(s) and s[front] != '(':
			front += 1
		while back >= 0 and s[back] != ')':
			back -= 1
	if len(bf) > len(bb):
		bf = bf[:len(bb)]
	else:
		bb = bb[:len(bf)]
	bb.sort()
	n = bf + bb
	for a in n[::-1]:
		del s[a]
	if len(n) != 0:
		ans.append(n)
	else:
		break
print(len(ans))
for a in ans:
	print(len(a))
	print(' '.join(map(lambda x: str(x + 1), a)))


from sys import stdin, stdout
s = stdin.readline()[:-1]
open = []
close = []
for i in range(len(s)):
	open.append(i + 1) if s[i] == '(' else close.append(i + 1)
close.reverse()
a = []
b = []
i = 0
while i < min(len(open), len(close)):
	if open[i] < close[i]:
		a.append(open[i])
		b.append(close[i])
		i += 1
	else:
		break
if i == 0:
	stdout.write('0\n')
else:
	stdout.write('1\n')
	stdout.write(str(len(a) + len(b)) + '\n')
	b.reverse()
	for x in a:
		stdout.write(str(x) + ' ')
	for x in b:
		stdout.write(str(x) + ' ')


def main():
	brackets = input()
	length = len(brackets)
	left = 0
	right = length - 1
	ans = []
	while left < right:
		while left < right and brackets[left] == ')':
			left += 1
		while left < right and brackets[right] == '(':
			right -= 1
		if left < right:
			ans.append(left + 1)
			ans.append(right + 1)
		left += 1
		right -= 1
	ans.sort()
	if len(ans) > 0:
		print(1)
		print(len(ans))
		print(*ans)
	else:
		print(0)
main()


s = input()
a = []
b = []
r = len(s)
l = 0
i = 0
while i < r:
	if s[i] == '(' and i + 1 not in a:
		l = i
		for j in range(r - 1, l, -1):
			if s[j] == ')' and j + 1 not in b:
				r = j
				a.append(i + 1)
				b.insert(-1, j + 1)
				break
	i += 1
if a == [] and b == []:
	print(0)
else:
	print(1)
	print(len(a) + len(b))
	c = a + b
	c.sort()
	for el in c:
		print(el, end=' ')


s = input()
n = len(s)
a = []
b = []
oc = cc = 0
start = 0
end = n - 1
while end >= start:
	if oc > cc:
		if s[end] == ')':
			cc += 1
			b.append(end + 1)
		end -= 1
	else:
		if s[start] == '(':
			oc += 1
			a.append(start + 1)
		start += 1
if oc == 0 or cc == 0:
	print('0')
else:
	print('1')
	if oc > cc:
		print(2 * cc)
		b.extend(a[:-1])
		b.sort()
		print(*b)
	elif cc > oc:
		print(2 * oc)
		a.extend(b[:-1])
		a.sort()
		print(*a)
	else:
		print(2 * oc)
		a.extend(b)
		a.sort()
		print(*a)


s = input()
n = len(s)
a = []
b = []
i = 0
j = n - 1
while i < j:
	if s[i] == '(' and s[j] == ')':
		a.append(i + 1)
		b = [j + 1] + b
		i += 1
		j -= 1
	elif s[j] == '(':
		j -= 1
	elif s[i] == ')':
		i += 1
if len(a) != 0:
	print(1)
	print(len(a) + len(b))
	print(*a, *b)
else:
	print(0)


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	a = insr()
	qw = []
	i = 0
	j = len(a) - 1
	c = 0
	while i < j:
		if a[i] == '(':
			if a[j] == ')':
				qw.append(i + 1)
				qw.append(j + 1)
				i = i + 1
				j = j - 1
				c = c + 1
			else:
				j = j - 1
		else:
			i = i + 1
	if c == 0:
		print(0)
	else:
		print(1)
		print(len(qw))
		print(*sorted(qw))


S = input()
N = len(S)
ans = []
vst = [False] * N
is_ans = 0
for _ in range(2):
	ret = []
	L = 0
	R = N - 1
	while L < R:
		while L < N and (vst[L] or S[L] == ')'):
			L += 1
		while R >= 0 and (vst[R] or S[R] == '('):
			R -= 1
		if L >= N or R < 0 or L > R:
			break
		ret.append(L + 1)
		ret.append(R + 1)
		vst[L] = True
		vst[R] = True
		L += 1
		R -= 1
	if ret:
		is_ans += 1
	ans.append(ret)
if is_ans:
	print(is_ans)
	for k in ans:
		if k:
			print(len(k))
			print(*sorted(k))
else:
	print(0)


s = input()
s = list(s)
n = len(s)
i = -1
mass = []
count = 0
while i < n - 1:
	i += 1
	j = n
	while j > 0 and i < j:
		j -= 1
		if s[i] == '(' and s[j] == ')':
			s[i] = '-'
			s[j] = '-'
			mass.extend([i + 1, j + 1])
			count += 2
sort_mass = sorted(mass)
if count == 0:
	print(0)
else:
	print(1)
	print(count)
	for i in range(len(sort_mass)):
		print(sort_mass[i], end=' ')


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	s = input()
	pre = [0] * (len(s) + 1)
	suf = [0] * (len(s) + 1)
	for i in range(len(s)):
		pre[i + 1] = (1 if s[i] == '(' else 0) + pre[i]
	for i in range(len(s) - 1, -1, -1):
		suf[i] = (1 if s[i] == ')' else 0) + suf[i + 1]
	mx = 0
	ind = -1
	for i in range(len(s)):
		if mx < min(pre[i + 1], suf[i]):
			mx = min(pre[i + 1], suf[i])
	ans = []
	ct = 0
	for i in range(len(s)):
		if mx == ct:
			break
		if s[i] == '(':
			ans.append(i)
			ct += 1
	ct = 0
	ans1 = []
	for i in range(len(s) - 1, -1, -1):
		if mx == ct:
			break
		if s[i] == ')':
			ans1.append(i)
			ct += 1
	ans1.sort()
	ans = ans + ans1
	if not ans:
		print(0)
	else:
		print(1)
		print(len(ans))
		for i in ans:
			print(i + 1, end=' ')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


s = input()
i = 0
j = len(s) - 1
indices = []
while True:
	while i < len(s) and s[i] == ')':
		i += 1
	while j >= 0 and s[j] == '(':
		j -= 1
	if i > j:
		break
	indices.extend([i, j])
	i += 1
	j -= 1
if len(indices):
	print('1')
	print(len(indices))
	indices.sort()
	print(' '.join(map(str, map(lambda x: x + 1, indices))))
else:
	print('0')


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def print_matrix(d):
	for i in range(len(d)):
		print(d[i])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def main():
	s = S()
	stack1 = []
	stack2 = []
	ans = []
	for i in range(len(s)):
		if s[i] == '(':
			stack1.append((i + 1, s[i]))
		else:
			stack2.append((i + 1, s[i]))
	min_bracket = min(len(stack1), len(stack2))
	for i in range(min_bracket, 0, -1):
		flag = True
		a = []
		for j in range(i):
			b1 = stack1[j][0]
			b2 = stack2[len(stack2) - j - 1][0]
			a.append(b1)
			a.append(b2)
			flag = flag and b1 < b2
			if flag is False:
				break
		if flag:
			ans.append((len(a), sorted(a)))
			break
	print(len(ans))
	if len(ans) > 0:
		for i in range(len(ans)):
			print(ans[i][0])
			print(*ans[i][1])
main()


sequence = input()
(list_index_one, list_index_two) = ([], [])
flag = False
while not flag:
	if sequence.find('(') < sequence.rfind(')') and (sequence.find('(') != -1 and sequence.rfind(')') != -1):
		list_index_one.append(sequence.find('('))
		list_index_two.append(sequence.rfind(')'))
		sequence = list(sequence)
		sequence[list_index_one[-1]] = ' '
		sequence[list_index_two[-1]] = ' '
		sequence = ''.join(sequence)
	else:
		flag = True
sequence = list(sequence)
list_index_two = list(reversed(list_index_two))
if len(list_index_one) == 0:
	print(0)
else:
	print(1)
	print(len(list_index_one) * 2)
	print(*[list_index_one[i] + 1 for i in range(len(list_index_one))] + [list_index_two[i] + 1 for i in range(len(list_index_two))])


s = input()
a = []
b = []
m = 0
n = len(s) - 1
while m < n:
	if s[m] == '(':
		while m < n:
			if s[n] == ')':
				a.append(m + 1)
				b.append(n + 1)
				m += 1
				n -= 1
				break
			else:
				n -= 1
	else:
		m += 1
if len(a) == 0:
	print('0')
else:
	print('1')
	print(2 * len(a))
	b.reverse()
	a.extend(b)
	print(' '.join(list(map(str, a))))


s = str(input())
n = len(s)
(dp2, dp1) = ([0] * n, [0] * n)
for i in range(n):
	if i == 0:
		dp1[0] = (s[i] == '(') * 1
	else:
		dp1[i] = dp1[i - 1] + (s[i] == '(') * 1
for i in range(n - 1, -1, -1):
	if i == n - 1:
		dp2[i] = (s[i] == ')') * 1
	else:
		dp2[i] = dp2[i + 1] + (s[i] == ')') * 1
(ma, goal) = (0, 0)
for i in range(n - 1):
	if min(dp1[i], dp2[i + 1]) > ma:
		ma = min(dp1[i], dp2[i + 1])
		goal = i
(count, ans) = (0, [])
for i in range(goal + 1):
	if s[i] == '(':
		ans.append(i)
		count += 1
	if count == ma:
		break
(count, ans2) = (0, [])
for i in range(n - 1, goal, -1):
	if s[i] == ')':
		ans2.append(i)
		count += 1
	if count == ma:
		break
if ma == 0:
	print(0)
else:
	print(1)
	print(ma * 2)
	for i in range(len(ans)):
		print(ans[i] + 1, end=' ')
	for i in range(len(ans2) - 1, -1, -1):
		print(ans2[i] + 1, end=' ')


s = input()
l = []
r = []
for i in range(len(s)):
	if s[i] == '(':
		l.append(i)
	else:
		r.append(i)
i = 0
l1 = len(l)
j = -1
rj = -len(r)
ans = []
while 1:
	if i < l1 and j >= rj and (l[i] < r[j]):
		ans.append(l[i] + 1)
		ans.append(r[j] + 1)
		i += 1
		j -= 1
	else:
		break
q = len(ans)
if q == 0:
	print(0)
else:
	print(1)
	print(q)
	ans.sort()
	print(*ans)


import sys

def arr_find(arr, c):
	for g in range(len(arr)):
		if arr[g] == c:
			return g
	return -1

def arr_rfind(arr, c):
	for h in range(len(arr) - 1, -1, -1):
		if arr[h] == c:
			return h
	return -1
s = sys.stdin.readline().strip()
n = len(s)
op = s.find('(')
cl = s.rfind(')')
if op == -1 or cl == -1 or cl < op:
	print(0)
else:
	arr = []
	ans = []
	for p in range(len(s)):
		arr.append(s[p])
	for g in range(n // 2 + 1):
		v1 = arr_find(arr, '(')
		v2 = arr_rfind(arr, ')')
		if v1 == -1 or v2 == -1 or v2 < v1:
			break
		else:
			arr[v1] = -1
			arr[v2] = -1
			ans.append(v1 + 1)
			ans.append(v2 + 1)
	print(1)
	print(len(ans))
	ans.sort()
	for e in range(len(ans)):
		print(ans[e], end=' ')
	print()


import sys
input = sys.stdin.readline
a = [1 if c == '(' else 0 for c in input().rstrip()]
n = len(a)
(l_acc, r_acc) = ([0] * n, [0] * n)
l_acc[0] = a[0]
for i in range(1, n):
	l_acc[i] += l_acc[i - 1] + a[i]
r_acc[-1] = a[-1] ^ 1
for i in range(n - 2, -1, -1):
	r_acc[i] = r_acc[i + 1] + (a[i] ^ 1)
ans = 0
for i in range(n - 1):
	ans = max(ans, min(l_acc[i], r_acc[i + 1]))
if ans == 0:
	print(0)
	exit()
ans_l = []
rem = ans
for i in range(n):
	if a[i]:
		ans_l.append(i + 1)
		rem -= 1
		if rem == 0:
			break
rem = ans
for i in range(n - 1, -1, -1):
	if a[i] == 0:
		ans_l.append(i + 1)
		rem -= 1
		if rem == 0:
			break
ans_l.sort()
print(1)
print(len(ans_l))
print(*ans_l)


from sys import exit
s = input()
if set(s) == set([')']) or set(s) == set(['(']):
	print(0)
	exit(0)
for i in range(1, len(s)):
	if set(s[:i]) == set([')']) and set(s[i:]) == set(['(']):
		print(0)
		exit(0)
c = len(s) - 1
num_open = s.count('(')
num_close = s.count(')')
num_open_copy = num_open
num_close_copy = num_close
delete = []
opens = []
closes = []
for i in range(len(s)):
	if s[i] == '(':
		opens.append(i)
for i in range(len(s) - 1, -1, -1):
	if s[i] == ')':
		closes.append(i)
for i in range(min(num_open_copy, num_close_copy)):
	if opens[i] > closes[i]:
		continue
	delete.append(opens[i])
	delete.append(closes[i])
delete.sort()
print(1)
print(len(delete))
for i in delete:
	print(i + 1, end=' ')
print()


s = input()
i = 0
j = len(s) - 1
ans = []
cnt = 0
while i < j:
	while i < j and s[i] == ')':
		i += 1
	while i < j and s[j] == '(':
		j -= 1
	if s[i] == '(' and s[j] == ')':
		cnt += 2
		ans.append(i + 1)
		ans.append(j + 1)
	i += 1
	j -= 1
ans.sort()
if cnt > 0:
	print(1)
print(cnt)
for x in ans:
	print(x, end=' ')
print()


from sys import stdout
s = list(input())
(i, j) = (0, len(s) - 1)
l = set()
while i < j:
	if s[i] == '(':
		while j > i and s[j] == '(':
			j -= 1
		if j > i:
			l.add(i)
			l.add(j)
			i += 1
			j -= 1
	else:
		i += 1
if len(l) == 0:
	print(0)
else:
	print(1)
	print(len(l))
for i in sorted(list(l)):
	stdout.write(str(i + 1) + ' ')


s = input()
l = len(s)
(i, j) = (0, l - 1)
li = []
while i <= j:
	if s[i] == '(' and s[j] == ')':
		li.append(i + 1)
		li.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == ')':
		i += 1
	elif s[j] == '(':
		j -= 1
if len(li) > 0:
	print(1)
print(len(li))
print(*sorted(li))


a = input()

def checkString(a):
	found = False
	done = True
	for m in a:
		if m == '(':
			found = True
		elif m == ')' and found == True:
			done = False
	return done
moves = 0
ans = []
while checkString(a) == False:
	frontIndex = 0
	backIndex = len(a) - 1
	fCount = []
	bCount = []
	while frontIndex < backIndex:
		if a[frontIndex] == '(' and a[backIndex] == ')':
			fCount.append(frontIndex + 1)
			bCount.append(backIndex + 1)
			frontIndex = frontIndex + 1
			backIndex = backIndex - 1
		elif a[frontIndex] == '(':
			backIndex = backIndex - 1
		elif a[backIndex] == ')':
			frontIndex = frontIndex + 1
		else:
			frontIndex = frontIndex + 1
			backIndex = backIndex - 1
	moves = moves + 1
	bCount.reverse()
	full = fCount + bCount
	ans.append((len(full), full))
	c = 0
	newA = ''
	for l in range(len(a)):
		if l != full[c] - 1:
			newA = newA + a[l]
		elif c < len(full) - 1:
			c = c + 1
	a = newA
print(moves)
for j in ans:
	print(j[0])
	print(' '.join(list(map(str, j[1]))))


strings = input()
(left, right) = (0, len(strings) - 1)
count = 0
ans = set()
while left < right:
	if strings[right] == '(':
		right -= 1
	elif strings[left] == '(':
		ans.add(right + 1)
		ans.add(left + 1)
		count += 1
		right -= 1
		left += 1
	if strings[left] == ')':
		left += 1
if count:
	print(1)
	print(len(ans))
	ans = list(ans)
	ans.sort()
	print(*ans)
else:
	print(0)


def outer_brackets(bracket_list):
	first_open = len(bracket_list)
	last_closed = 0
	for i in range(len(bracket_list)):
		if bracket_list[i] == '(':
			first_open = i
			break
	for i in range(1, len(bracket_list) + 1):
		if bracket_list[-i] == ')':
			last_closed = len(bracket_list) - i
			break
	return [first_open, last_closed]

def print_list(list):
	answer = ''
	for item in list:
		answer += str(item) + ' '
	print(answer)

def add_one_to_list(list):
	for i in range(len(list)):
		list[i] += 1
brackets = input()
bracket_list = []
for bracket in brackets:
	bracket_list.append(bracket)
move_count = 0
is_simple = False
is_reducible = True
remove_history = []
while is_simple is False:
	pairs_to_remove = []
	while is_reducible is True:
		current_pair = outer_brackets(bracket_list)
		first_open = current_pair[0]
		last_closed = current_pair[1]
		if first_open < last_closed:
			pairs_to_remove.append(current_pair[0])
			pairs_to_remove.append(current_pair[1])
			bracket_list[current_pair[0]] = 'x'
			bracket_list[current_pair[1]] = 'x'
		else:
			is_reducible = False
	pairs_to_remove.sort()
	if not pairs_to_remove:
		is_simple = True
	else:
		remove_history.append(pairs_to_remove)
		move_count += 1
print(move_count)
for move in remove_history:
	add_one_to_list(move)
	print(len(move))
	print_list(move)


from collections import deque
import sys
input = sys.stdin.readline
s = input()
n = len(s)
l = 0
r = n - 1
cnt = 0
ans = []
while True:
	while True:
		if l >= n:
			break
		if s[l] == '(':
			break
		else:
			l += 1
	while True:
		if r < 0:
			break
		if s[r] == ')':
			break
		else:
			r -= 1
	if l >= r:
		break
	cnt += 1
	ans.append(l + 1)
	ans.append(r + 1)
	l += 1
	r -= 1
if cnt == 0:
	print(cnt)
	exit()
print(1)
ans = sorted(ans)
print(len(ans))
print(*ans)


from collections import deque

def main():
	s = input()
	a = []
	b = []
	for (idx, x) in enumerate(s):
		if x == '(':
			a.append(idx)
		else:
			b.append(idx)
	a = deque(a)
	b = deque(b)
	s = []
	while len(a) and len(b) and (a[0] < b[-1]):
		s.append(a.popleft())
		s.append(b.pop())
	if len(s) == 0:
		print('0\n')
		return
	print('1')
	print(len(s))
	print(' '.join([str(a + 1) for a in sorted(s)]))
main()


s = input()
l1 = []
l2 = []
for i in range(len(s)):
	if s[i] == '(':
		l1.append(i)
	if s[i] == ')':
		l2.append(i)
i = 0
j = len(l2) - 1
l3 = []
while i < len(l1) and j >= 0:
	if l1[i] > l2[j]:
		break
	l3.append(l1[i] + 1)
	l3.append(l2[j] + 1)
	i += 1
	j -= 1
l3.sort()
if len(l3) == 0:
	print(0)
else:
	print(1)
	print(len(l3))
	print(*l3)


s = input()
s = list(s)
n = len(s)
i = 0
j = n - 1
Ans = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		Ans.append(i + 1)
		Ans.append(j + 1)
		s[i] = ''
		s[j] = ''
		i += 1
		j -= 1
	elif s[i] == '(' and s[j] != ')':
		j -= 1
	elif s[i] == ')':
		i += 1
if len(Ans) == 0:
	print(0)
else:
	print(1)
	print(len(Ans))
	Ans.sort()
	print(*Ans)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():
	ss = input()
	lcount = [0]
	for s in ss:
		lcount.append(lcount[-1] + (1 if s == '(' else 0))
	rpos = []
	rcount = 0
	for i in range(len(ss), 0, -1):
		if ss[i - 1] == ')':
			if rcount >= lcount[i]:
				break
			rpos.append(i)
			rcount += 1
	lcount = 0
	lpos = []
	for (i, s) in enumerate(ss, 1):
		if s == '(':
			if lcount == rcount:
				break
			lpos.append(i)
			lcount += 1
	if rcount >= 1:
		print(1)
		print(rcount * 2)
		print(' '.join(map(str, lpos + rpos[::-1])))
	else:
		print(0)
main()


s = input()
l = len(s)
a = [0] * l
k = 0
j = l - 1
for i in range(l):
	if s[i] == '(':
		while j > i:
			if s[j] == ')':
				a[k] = i
				a[l - k - 1] = j
				k += 1
				j -= 1
				break
			else:
				j -= 1
if k == 0:
	print(0)
else:
	print('1\n' + str(2 * k))
	for i in range(k):
		print(a[i] + 1, end=' ')
	for i in range(k):
		print(a[l - k + i] + 1, end=' ')


s = input()
left = 0
right = len(s) - 1
l = []
while left < right:
	if (s[left] == '(') & (s[right] == ')'):
		l.append(left + 1)
		l.append(right + 1)
		left += 1
		right -= 1
		continue
	if s[left] != '(':
		left += 1
	if s[right] != ')':
		right -= 1
l.sort()
if len(l) > 0:
	print(1)
	print(len(l))
	print(' '.join(map(str, l)))
else:
	print(0)


s = input()
i = 0
j = len(s) - 1
a = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		a.append(i + 1)
		a.append(j + 1)
		i += 1
		j -= 1
	elif s[i] == ')':
		i += 1
	else:
		j -= 1
if a > []:
	print(1)
	print(len(a))
	a.sort()
	print(*a)
else:
	print(0)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		s = S()
		sl = len(s)
		l = 0
		r = sl - 1
		t = []
		while l < r:
			while l < sl and s[l] == ')':
				l += 1
			while r >= 0 and s[r] == '(':
				r -= 1
			if l >= r:
				break
			t.append(l + 1)
			t.append(r + 1)
			l += 1
			r -= 1
		if t:
			t.sort()
			rr.append(1)
			rr.append(len(t))
			rr.append(JA(t, ' '))
		else:
			rr.append(0)
	return JA(rr, '\n')
print(main())


s = input()
n = len(s)
ret = []
(left, right) = (0, n - 1)
while left < right:
	while left < right and s[left] != '(':
		left += 1
	while right > left and s[right] != ')':
		right -= 1
	if left < right:
		ret.extend((left + 1, right + 1))
	left += 1
	right -= 1
ret.sort()
print('1\n%d\n%s' % (len(ret), ' '.join(map(str, ret))) if ret else '0')


s = input()
p_lo = 0
p_hi = len(s) - 1
rem_lo = []
rem_hi = []
while p_lo < p_hi:
	if s[p_lo] == ')':
		p_lo += 1
	elif s[p_hi] == '(':
		p_hi -= 1
	else:
		rem_lo.append(p_lo)
		rem_hi.append(p_hi)
		p_lo += 1
		p_hi -= 1
if len(rem_lo) == 0:
	print(0)
else:
	print(1)
	print(2 * len(rem_lo))
	print(*[x + 1 for x in rem_lo + list(reversed(rem_hi))])


s = input()
L = len(s)
a = []
x = 0
y = L - 1
while x < L and s[x] != '(':
	x += 1
while y >= 0 and s[y] != ')':
	y -= 1
while x < L and y >= 0 and (x < y):
	a.append(x)
	a.append(y)
	x += 1
	y -= 1
	while x < L and s[x] != '(':
		x += 1
	while y >= 0 and s[y] != ')':
		y -= 1
if a == []:
	print('0')
else:
	print('1')
	a.sort()
	print(len(a))
	print(' '.join(map(lambda x: str(x + 1), a)))


n = input()
r = len(n)
b = []
c = 0
for i in range(len(n)):
	for j in range(r - 1, i, -1):
		if n[i] == '(' and n[j] == ')':
			c = 1
			n = n[0:i] + '0' + n[i + 1:]
			n = n[0:j] + '0' + n[j + 1:]
			b.append(i + 1)
			b.append(j + 1)
if c == 0:
	print(c)
else:
	print(c)
	print(len(b))
	b.sort()
	for j in range(len(b)):
		print(b[j], end=' ')


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log
import math
from itertools import permutations
from copy import deepcopy
from sys import setrecursionlimit

def main():
	s = input().rstrip()
	f = []
	b = []
	for (i, v) in enumerate(s):
		if v == '(':
			f.append(i + 1)
		else:
			b.append(i + 1)
	i = 0
	a = []
	while i < min(len(f), len(b)):
		if f[i] > b[-(i + 1)]:
			break
		a.append(f[i])
		a.append(b[-(i + 1)])
		i += 1
	if a == []:
		print(0)
	else:
		print(1)
		print(len(a))
		print(*sorted(a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


INF = 10 ** 10

def main():
	st = list(input())
	l = 0
	r = len(st) - 1
	indexL = []
	indexR = []
	while l < r:
		while l < len(st) and st[l] != '(':
			l += 1
		while r > 0 and st[r] != ')':
			r -= 1
		if l < r:
			indexL.append(l + 1)
			indexR.append(r + 1)
		l += 1
		r -= 1
	if len(indexL) > 0:
		print(1)
		print(2 * len(indexL))
		indexR.reverse()
		print(' '.join(map(str, indexL + indexR)))
	else:
		print(0)
import sys
from collections import defaultdict, Counter, deque
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()
print(*out, sep='\n')


s = input()
l1 = []
l2 = []
for i in range(len(s)):
	if s[i] == '(':
		l1.append(i + 1)
	elif s[i] == ')':
		l2.append(i + 1)
c = 0
for i in range(min(len(l1), len(l2))):
	if l1[i] < l2[-i - 1]:
		c += 1
	else:
		break
if c:
	print(1)
	print(c * 2)
	print(*l1[:c], *l2[-c:])
else:
	print(0)


from collections import defaultdict as dd
arr = list(input().strip())
for i in range(len(arr)):
	if arr[i] == '(':
		arr[i] = 1
	else:
		arr[i] = -1
n = len(arr)
ans = []
while True:
	d = dd(list)
	d1 = dd(list)
	d[-1] = []
	d1[n] = []
	for i in range(n):
		if arr[i] == 1:
			d[i] += d[i - 1] + [i]
		elif arr[i] == -1:
			d[i] += d[i - 1]
	for i in range(n - 1, -1, -1):
		if arr[i] == -1:
			d1[i] += d1[i + 1] + [i]
		elif arr[i] == 1:
			d1[i] += d1[i + 1]
	maxi = 0
	maxind = -1
	for i in range(n):
		r = min(len(d[i]), len(d1[i]))
		if r > maxi:
			maxi = r
			maxind = i
	x = []
	for i in range(maxi):
		x += [d[maxind][i] + 1, d1[maxind][i] + 1]
		arr[d[maxind][i]] = 0
		arr[d1[maxind][i]] = 0
	if maxi == 0:
		break
	ans += [x]
print(len(ans))
for i in ans:
	print(len(i))
	i.sort()
	print(*i)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
string = [k for k in input()]
n = len(string)
ind1 = []
ind2 = []
for s in range(n):
	if string[s] == '(':
		ind1.append(s)
for s in range(n - 1, -1, -1):
	if string[s] == ')':
		ind2.append(s)
outy = []
for s in range(min(len(ind1), len(ind2))):
	if ind1[s] < ind2[s]:
		outy.append(ind1[s] + 1)
		outy.append(ind2[s] + 1)
	else:
		break
outy.sort()
if len(outy) == 0:
	print(0)
else:
	print(1)
	print(len(outy))
	print(*outy)


s = input()
a = [0 for i in range(len(s))]
k = 0
i = 0
j = len(s) - 1
while 1:
	while s[i] != '(' or a[i] == 1:
		i += 1
		if i == len(s) or i == j:
			break
	if i == len(s) or i == j:
		if i == j and k % 2:
			a[i] = 0
			k -= 1
		break
	else:
		k += 1
		a[i] = 1
	while s[j] != ')' or a[j] == 1:
		j -= 1
		if j == -1 or i == j:
			if i == j and k % 2:
				a[j] = 0
				k -= 1
			break
	if j == len(s) or j == i:
		break
	else:
		k += 1
		a[j] = 1
if not k:
	print(0)
	exit(0)
print(1)
print(k)
for i in range(len(a)):
	if a[i] == 1:
		print(i + 1, end=' ')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	if True:
		s = list(si())
		n = len(s)
		a = []
		f = [0] * n
		for i in range(n):
			f[i] = 1
			if s[i] == '(':
				ff = 0
				for j in range(n - 1, -1, -1):
					if f[j] == 0 and s[j] == ')':
						ff = 1
						f[j] = 1
						a.append(j + 1)
						break
					f[j] = 1
				if ff == 1:
					a.append(i + 1)
		a.sort()
		if len(a) == 0:
			print(0)
		else:
			print(1)
			print(len(a))
			print(*a)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
string = input().rstrip()
length = len(string)
array_left = [0] * length
array_right = [0] * length
sum_left = 0
sum_right = 0
for i in range(length):
	if string[i] == '(':
		sum_left += 1
	array_left[i] = sum_left
	inverse_i = length - i - 1
	if string[inverse_i] == ')':
		sum_right += 1
	array_right[inverse_i] = sum_right
m = 0
for i in range(len(string)):
	m = max(m, min(array_left[i], array_right[i]))
if m > 0:
	print(1)
	print(2 * m)
	answer = []
	k = m
	for i in range(length):
		if k and string[i] == '(':
			answer.append(i + 1)
			k -= 1
	k = m
	for i in range(length):
		inverse_i = length - i - 1
		if k and string[inverse_i] == ')':
			answer.append(inverse_i + 1)
			k -= 1
	answer.sort()
	print(*answer)
else:
	print(0)


s = input()
countA = 0
countB = 0
m = 0
ans = []
totalAns = []
for i in range(len(s)):
	if s[i] == '(':
		countA += 1
		ans.append(i + 1)
	countB = 0
	ansB = []
	for j in range(i + 1, len(s)):
		if s[j] == ')':
			countB += 1
			ansB.append(j + 1)
		if countA == countB:
			totalAns = ans + ansB
			break
	if countA > countB:
		break
if len(totalAns) != 0:
	print(1)
print(len(totalAns))
print(*totalAns)


import collections
import itertools
from functools import reduce
mod = 10 ** 9 + 7

def permutationbysum():
	for _ in range(int(input())):
		(num, l, r, achieve) = map(int, input().split())
		k = r - l + 1
		if k * (k + 1) // 2 <= achieve <= k * (num * 2 + 1 - k) // 2:
			outpos = r % num
			inpos = l - 1
			ans = [0] * num
			for i in range(num, 0, -1):
				if achieve - i > 0 or (achieve - i == 0 and inpos == r - 1):
					achieve -= i
					ans[inpos] = i
					inpos += 1
				else:
					ans[outpos] = i
					outpos += 1
					outpos %= num
			print(*ans)
		else:
			print(-1)

def peaks():
	for _ in range(int(input())):
		(num, peak) = map(int, input().split())
		pos = 1
		rpos = num
		ans = []
		now = 0
		if num == 1:
			if not peak:
				print(1)
			else:
				print(-1)
			continue
		if num == 2:
			if peak:
				print(-1)
			else:
				print(1, 2)
			continue
		added = 0
		while rpos + 1 != pos:
			if not peak:
				while pos <= rpos:
					ans.append(pos)
					pos += 1
				break
			if not now:
				ans.append(pos)
				pos += 1
			else:
				ans.append(rpos)
				rpos -= 1
				if num - added != 1:
					peak -= 1
			added += 1
			now = 1 - now
		if peak:
			print(-1)
			continue
		print(*ans)
import sys
input = sys.stdin.readline

def addone():
	for _ in range(int(input())):
		(num, changes) = input().split()
		l = collections.deque(sorted([int(i) for i in num]))
		perm = collections.deque()
		changes = int(changes)
		cd = 0
		ans = len(num)
		while True:
			nextnum = l.pop()
			while perm and perm[-1] == nextnum:
				l.append(perm.pop())
			c = 10 - nextnum - cd
			changes -= c
			cd += c
			if changes >= 0:
				if not c:
					perm.appendleft(1 - cd)
					l.appendleft(-cd)
				else:
					l.appendleft(1 - cd)
					l.appendleft(-cd)
				ans += 1
			else:
				break
		print(ans % 1000000007)
import math

def andsequences():

	def mapping(num):
		nonlocal mnum
		nonlocal c
		num = int(num)
		if num < mnum:
			mnum = num
			c = 1
		elif num == mnum:
			c += 1
		return num
	mod = 1000000007
	for _ in range(int(input())):
		mnum = float('inf')
		c = 0
		num = int(input())
		l = list(map(mapping, input().split()))
		for i in l:
			if mnum & i != mnum:
				print(0)
				break
		else:
			if c == 1:
				print(0)
			else:
				print(math.factorial(num - 2) * (c - 1) * c % mod)

def numberdigit():
	n = 10 ** 5 * 2
	l = [0] * 11
	mod = 10 ** 9 + 7
	l[0] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = 2
	l[9] = 3
	l[10] = 4
	for i in range(11, n):
		l.append((l[i - 10] + l[i - 9]) % mod)
	for _ in range(int(input())):
		(num, c) = input().split()
		c = int(c)
		ans = 0
		for i in num:
			i = int(i)
			if 10 - i > c:
				ans += 1
			else:
				ans += l[c - (10 - i)]
		print(ans % mod)

def mushroom():
	(people, t1, t2, percent) = map(int, input().split())
	l = []
	percent = 1 - percent * 0.01
	for i in range(1, people + 1):
		(s, s1) = map(int, input().split())
		l.append([i, max(s * t1 * percent + s1 * t2, s1 * t1 * percent + s * t2)])
	l.sort(key=lambda x: x[1], reverse=True)
	for i in l:
		i[1] = '{:.2f}'.format(i[1])
		print(*i)

def escape():
	prins = int(input())
	dra = int(input())
	start = int(input())
	pack = int(input())
	c = int(input())
	speeddiff = dra - prins
	if speeddiff <= 0:
		return 0
	pd = start * prins
	ans = 0
	while pd < c:
		hs = pd / speeddiff
		pd += prins * hs
		if pd >= c:
			break
		time = pd / dra
		time += pack
		pd += prins * time
		ans += 1
	return ans

def perm():

	def high(n, k):
		return k * (2 * n - k + 1) // 2

	def low(k):
		return k * (k + 1) // 2
	for _ in range(int(input())):
		(num, lef, rig, s) = map(int, input().split())
		k = rig - lef + 1
		(rig, lef) = (rig - 1, lef - 1)
		if not high(num, k) >= s >= low(k):
			print(-1)
			continue
		l = [0] * num
		lp = lef
		rp = lef - 1
		for i in range(num, 0, -1):
			if high(i, k) >= s and s - i >= low(k - 1) and k:
				l[lp] = i
				lp += 1
				s -= i
				k -= 1
			else:
				l[rp] = i
				rp -= 1
		if k:
			print(-1)
		else:
			print(*l)

def newcom():
	for _ in range(int(input())):
		(days, price) = map(int, input().split())
		dl = input().split()
		worth = input().split()
		worth.append(0)
		ans = float('inf')
		req = 0
		left = 0
		for i in range(days):
			a = int(dl[i])
			w = int(worth[i])
			ans = min(ans, req + max(0, price - left + a - 1) // a)
			ns = max(0, w - left + a - 1) // a
			req += ns + 1
			left += a * ns - w
		print(ans)

def perfectsq():
	for _ in range(int(input())):
		n = input()
		for i in input().split():
			sq = math.sqrt(int(i))
			if sq != int(sq):
				print('YES')
				break
		else:
			print('NO')

def and0big():
	for _ in range(int(input())):
		(l, k) = map(int, input().split())
		print(l ** k % mod)
import math

def mod1p():
	n = int(input())
	ans = dict()
	p = 1
	for i in range(1, n):
		if math.gcd(i, n) == 1:
			ans[str(i)] = True
			p = p * i % n
	if p == 1:
		print(len(ans))
		print(' '.join(ans.keys()))
	else:
		ans.pop(str(p))
		print(len(ans))
		print(' '.join(ans.keys()))

def shorttask():
	num = 10000100
	l = [-1] * (num + 2)
	s = [-1] * (num + 2)
	l[1] = 1
	for i in range(2, int(math.sqrt(num + 1)) + 2):
		if l[i] == -1:
			l[i] = i
			for x in range(i * i, num + 1, i):
				if l[x] == -1:
					l[x] = i
	s[1] = 1
	for i in range(2, num + 1):
		if l[i] == -1:
			l[i] = i
			s[i] = i + 1
		else:
			i1 = i
			s[i] = 1
			while i1 % l[i] == 0:
				i1 //= l[i]
				s[i] = s[i] * l[i] + 1
			s[i] *= s[i1]
	ans = [-1] * (num + 1)
	for i in range(num, 0, -1):
		if s[i] < num:
			ans[s[i]] = i
	for _ in range(int(input())):
		print(ans[int(input())])

def review():
	for _ in range(int(input())):
		n = int(input())
		ans = 0
		for i in input().split():
			i = int(i)
			if i == 1 or i == 3:
				ans += 1
		print(ans)

def GCDleng():
	po10 = [0] * 11
	po10[1] = 1
	for i in range(2, 11):
		po10[i] = po10[i - 1] * 10
	for _ in range(int(input())):
		(n, n1, res) = map(int, input().split())
		print(po10[n], po10[n1] + po10[res])

def anothercarddeck():
	(n, q) = map(int, input().split())
	l = input().split()
	d = {l[i]: i for i in range(n - 1, -1, -1)}
	ans = []
	for i in input().split():
		now = d[i]
		ans.append(now + 1)
		for key in d:
			if d[key] < now:
				d[key] += 1
		d[i] = 0
	print(*ans)

def mincoststring():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	ans = []
	real = letters - 1
	if not n:
		print(*ans, sep='')
		return
	if n == 1:
		print(*ans, sep='', end='')
		print(l[1 % (real + 1)])
		return
	while n:
		for i in range(len(l)):
			for i1 in range(i, len(l)):
				if i1 != real:
					ans.append(l[i1])
					ans.append(l[i])
					n -= 2
				else:
					ans.append(l[i1])
					n -= 1
				if not n:
					print(*ans, sep='')
					return
				if n == 1:
					print(*ans, sep='', end='')
					print(l[(i1 + 1) % (real + 1)])
					return
	print(*ans)

def mincost2():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	comb = []
	if letters == 1 or n == 1:
		print('a' * n)
		return
	for i in range(letters):
		for i1 in range(i, letters):
			comb.append(l[i1] + l[i])
	lc = len(comb)
	while True:
		for i in range(lc):
			if ord(comb[i][0]) - 97 == letters - 1:
				n -= 1
				print(comb[i][0], end='')
			else:
				n -= 2
				print(comb[i], end='')
			if n == 1:
				pos = ord(comb[i][0]) - 97 + 1
				print(l[pos % letters])
				return
			if not n:
				return

def Tittat():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = list(map(int, input().split()))
		for i in range(n):
			if not k:
				break
			while k and l[i]:
				l[i] -= 1
				l[-1] += 1
				k -= 1
		print(*l)

def xorq2():
	for _ in range(int(input())):
		n = int(input())
		s = 0
		num = -1
		nc = 0
		c = 0
		for i in input().split():
			i = int(i)
			s ^= i
			c += 1
			if num == -1 and s == i:
				num = s
				s = 0
				nc += c
				c = 0
			if num != -1 and (s == num or not s):
				s = 0
				nc += c
				c = 0
		print(['NO', 'YES'][nc == n])

def xorq2re():
	n = int(input())
	s = input().split()
	xor = 0
	for i in range(n):
		s[i] = int(s[i])
		xor ^= s[i]
	if not xor:
		print('YES')
	else:
		new = 0
		ans = 0
		for i in s:
			new ^= i
			if new == xor:
				new = 0
				ans += 1
		print(['NO', 'YES'][ans > 1])
import sys
sys.setrecursionlimit(2300)

def q3partition():

	def partition():
		if tol % 2:
			return 0
		up = tol
		rec = [[False] * (up + 2) for _ in range(n + 1)]
		rec[0][0] = True
		for i in range(1, n + 1):
			v = l[i - 1]
			for j in range(up + 1):
				if rec[i - 1][j]:
					if v + j <= up:
						rec[i][j + v] = True
					rec[i][j] = True
		return rec[n][tol // 2]

	def ints(x):
		nonlocal tol
		nonlocal gcf
		x = int(x)
		tol += x
		gcf = math.gcd(gcf, x) if gcf != float('inf') else x
		return x
	n = int(input())
	tol = 0
	gcf = float('inf')
	l = list(map(ints, input().split()))
	if partition():
		pos = 1
		for i in l:
			if i // gcf % 2:
				print(1)
				print(pos)
				return
			pos += 1
	else:
		print(0)

def permu(n, r):
	return math.factorial(n) // math.factorial(n - r)

def comb(n, r):
	return math.factorial(n) // math.factorial(r) * math.factorial(n - r)

def calc():
	n = int(input())
	ans = permu(n, n)
	for i in range(1, n + 1):
		ans -= comb(n, i)
	print(ans)

def order():
	for _ in range(int(input())):
		n = int(input())
		odd = []
		even = []
		for i in input().split():
			i = int(i)
			if i % 2:
				odd.append(i)
			else:
				even.append(i)
		print(*odd + even)

def TMTdoc():
	n = int(input())
	l = input().rstrip()
	tts = 0
	tms = 0
	for i in l:
		if i == 'T':
			tts += 1
		else:
			tms += 1
	if tms * 2 == tts:
		nowts = 0
		nowms = 0
		for i in l:
			if i == 'T':
				nowts += 1
			else:
				nowms += 1
				if nowts >= nowms and tms - nowms + 1 <= tts - nowts:
					continue
				return 'NO'
	else:
		return 'NO'
	return 'YES'

def relayrace():

	def solve(n):
		if n:
			s = -1
		else:
			s = 1
		nowmax = -float('inf')
		nowmin = -nowmax
		ans = 0
		for (i, v) in sorted(l, key=lambda x: (x[1], s * int(x[0])), reverse=True):
			i = int(i)
			if i > nowmax:
				nowmax = i
			if i < nowmin:
				nowmin = i
			ans += v * (nowmax - nowmin)
		return ans
	n = int(input())
	l = -1
	ans = 0
	for i in sorted(input().split(), key=lambda x: int(x)):
		if l == -1:
			l = int(i)
		else:
			ans += int(i) - l
	return ans

def relayraces():
	n = int(input())
	l = sorted(map(int, input().split()))
	minv = float('INF')
	minpos = 0
	for i in range(len(l)):
		if i > 0 and 0 <= l[i] - l[i - 1] <= minv:
			minv = l[i] - l[i - 1]
			minpos = i
		if i < n - 1 and l[i + 1] - l[i] <= minv:
			minv = l[i + 1] - l[i]
			minpos = i
	lpos = minpos - 1
	rpos = minpos + 1
	ans = 0
	while lpos >= 0 and rpos < n:
		diffl = -(l[lpos] - l[minpos])
		diffr = l[rpos] - l[minpos]
		if diffl < diffr:
			minpos = lpos
			lpos -= 1
			ans += diffl
		else:
			minpos = rpos
			rpos += 1
			ans += diffr
	if lpos < 0:
		m = l[0]
		for i in range(rpos, n):
			ans += l[i] - m
	else:
		h = l[-1]
		for i in range(minpos, -1, -1):
			ans += h - l[i]
	return ans

def relayracess():

	def recur(l, r):
		if l == r:
			return 0
		if d[l, r] != -1:
			return d[l, r]
		ans = nums[r] - nums[l] + min(recur(l + 1, r), recur(l, r - 1))
		d[l, r] = ans
		return ans
	d = collections.defaultdict(lambda : -1)
	n = int(input())
	nums = sorted(map(int, input().split()))
	return recur(0, n - 1)

def relayracesss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [[0] * n for _ in range(n)]
	for i in range(n - 2, -1, -1):
		for i1 in range(i + 1, n):
			dp[i][i1] = l[i1] - l[i] + min(dp[i + 1][i1], dp[i][i1 - 1])
	return dp[0][n - 1]

def relayracessss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [0] * n
	for le in range(n - 2, -1, -1):
		for ri in range(le + 1, n):
			dp[ri] = l[ri] - l[le] + min(dp[ri], dp[ri - 1])
	return dp[-1]

def binli():
	n = int(input())
	n2 = n * 2
	s = input().rstrip()
	s1 = input().rstrip()
	s2 = input().rstrip()
	posl = [0, 0, 0]
	ans = ''
	while max(posl) < n2:
		l = [[], []]
		l[int(s[posl[0]])].append(0)
		l[int(s1[posl[1]])].append(1)
		l[int(s2[posl[2]])].append(2)
		if len(l[0]) >= 2:
			for i in l[0]:
				posl[i] += 1
			ans += '0'
		else:
			for i in l[1]:
				posl[i] += 1
			ans += '1'
	if posl[0] == n2:
		if posl[1] >= posl[2]:
			ans += s1[posl[1]:]
		else:
			ans += s2[posl[2]:]
	elif posl[1] == n2:
		if posl[0] >= posl[2]:
			ans += s[posl[0]:]
		else:
			ans += s2[posl[2]:]
	elif posl[0] >= posl[1]:
		ans += s[posl[0]:]
	else:
		ans += s1[posl[1]:]
	print(ans)

def almostsort():
	(n, k) = map(int, input().split())
	ul = 2 ** (n - 1)
	if k > ul:
		return [-1]
	permen = []
	bi = bin(k - 1)[2:]
	if bi == '0':
		return range(1, n + 1)
	pos = n - len(bi)
	ans = list(range(1, pos))
	for i in bi:
		permen.append(pos)
		if not int(i):
			ans += permen[::-1]
			permen = []
		pos += 1
	permen.append(n)
	ans += permen[::-1]
	return ans

def q1_2050():
	for i in range(int(input())):
		s = int(input())
		if s % 2050:
			print(-1)
		else:
			ab = 2050
			while ab <= s:
				ab *= 10
			ab //= 10
			c = 0
			while s and s != 1:
				c += s // ab
				s = s % ab
				while s != 1 and s and (s < ab):
					ab //= 10
			print(c)

def q2jog():
	(n, m) = map(int, input().split())
	sortbyval = []
	rowsv = [collections.defaultdict(int) for _ in range(n)]
	for row in range(n):
		for i in input().split():
			i = int(i)
			sortbyval.append([i, row])
			rowsv[row][i] += 1
	sortbyval.sort(key=lambda x: x[0])
	larl = []
	for i in range(0, n * m, m):
		larl.append(sortbyval[i:i + m])
	ans = [[0] * m for _ in range(n)]
	person = 0
	for i in larl:
		for (v, pos) in i:
			ans[pos][person] = v
			rowsv[pos][v] -= 1
			person += 1
			if person == m:
				break
		else:
			continue
		break
	for r in range(n):
		for c in range(m):
			if not ans[r][c]:
				for key in list(rowsv[r].keys()):
					if not rowsv[r][key]:
						rowsv[r].pop(key)
						continue
					rowsv[r][key] -= 1
					ans[r][c] = key
					break
	for i in ans:
		print(*i)

def q3fillomino(n, inp):

	def gorow():
		nonlocal nowp
		nonlocal col
		nonlocal totake
		t = 0
		if nowp and col < n and totake and (not l[col][nowp - 1]):
			for back in range(nowp, -1, -1):
				if l[col][back]:
					nowp += 1
					col += 1
					return t
				if not totake:
					return t
				l[col][back] = i
				totake -= 1
				nowp -= 1
				t = 1
			nowp += 1
			col += 1
		return t
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		totake = int(i)
		nowp = p
		col = p
		while col < n:
			if not totake:
				break
			for _ in range(n - p):
				if not gorow():
					break
			if not totake or col == n or nowp == n:
				break
			l[col][nowp] = i
			totake -= 1
			col += 1
		p += 1
	for i in l:
		print(*i)

def q3fillominoclear(n, inp):
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		take = int(i) - 1
		l[p][p] = i
		(x, y) = (p, p)
		while take:
			if y and (not l[x][y - 1]):
				y -= 1
			else:
				x += 1
			l[x][y] = i
			take -= 1
		p += 1
	for i in l:
		print(*i)

def q4explor():

	def gen(r, c):
		res = float('inf')
		if r:
			res = min(res, his[r - 1][c] + 2 * colstep[r - 1][c])
		if r < rows - 1:
			res = min(res, his[r + 1][c] + 2 * colstep[r][c])
		if c:
			res = min(res, his[r][c - 1] + 2 * rowstep[r][c - 1])
		if c < cols - 1:
			res = min(res, his[r][c + 1] + 2 * rowstep[r][c])
		return res
	(rows, cols, k) = map(int, input().split())
	if k % 2:
		for i in range(rows):
			print(*[-1] * cols)
		return
	rowstep = [list(map(int, input().split())) for _ in range(rows)]
	colstep = [list(map(int, input().split())) for _ in range(rows - 1)]
	his = [[0] * cols for _ in range(rows)]
	for _ in range(k // 2):
		temp = [[gen(r, c) for c in range(cols)] for r in range(rows)]
		his = temp
	for i in his:
		print(*i)

def cvacations():

	def de(v):
		nonlocal last
		if v == 2:
			last = 2
		elif v == 1:
			last = 1
	n = int(input())
	ans = 0
	last = 0
	l = input().split()
	for i1 in range(n):
		i = int(l[i1])
		if not i:
			last = 0
			ans += 1
			continue
		if i == 1:
			if last != 2:
				last = 2
				continue
			ans += 1
			last = 0
		elif i == 2:
			if last != 1:
				last = 1
				continue
			ans += 1
			last = 0
		elif not last:
			if i1 < n - 1:
				de(int(l[i1 + 1]))
				if int(l[i1 + 1]) == 3:
					for pos in range(i1 + 2, n):
						if l[pos] != 3:
							r = l[pos]
							break
					else:
						last = 1
						continue
					de(r)
			else:
				break
		elif last == 1:
			last = 2
		elif last == 2:
			last = 1
	return ans

def brackets():
	s = input().rstrip()
	(lpos, rpos) = (0, len(s) - 1)
	ans = []
	while lpos + 1 <= rpos:
		if s[lpos] == '(':
			if s[rpos] == ')':
				ans.append(lpos + 1)
				ans.append(rpos + 1)
				lpos += 1
				rpos -= 1
			else:
				rpos -= 1
		else:
			lpos += 1
	if ans:
		print(1)
		print(len(ans))
		print(*sorted(ans))
	else:
		print(0)

def main():
	brackets()
main()


s = input()
a = []
b = []
for i in range(len(s)):
	if s[i] == '(':
		a.append(i)
	else:
		b.append(i)
if len(a) == 0 or len(b) == 0:
	print(0)
else:
	i = 0
	j = len(b) - 1
	ls = []
	while i < len(a) and j >= 0 and (a[i] < b[j]):
		if a[i] < b[j]:
			ls.append(a[i] + 1)
			ls.append(b[j] + 1)
			i += 1
			j -= 1
		else:
			break
	if len(ls):
		ls.sort()
		print(1)
		print(len(ls))
		print(*ls)
	else:
		print(0)


s = input()
x = 0
y = len(s) - 1
l = []
while x < y:
	if s[x] == '(' and s[y] == ')':
		l.extend([x + 1, y + 1])
		x += 1
		y -= 1
	elif s[x] == ')' and s[y] == '(':
		x += 1
		y -= 1
	elif s[x] == ')' and s[y] == ')':
		x += 1
	else:
		y -= 1
if len(l):
	print(1)
	print(len(l))
	print(*sorted(l))
else:
	print(0)


from os import path
import sys
from collections import defaultdict, Counter
maxx = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
else:
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
s = S()
(o, c) = ([], [])
(m1, m2) = (-1, -1)
(c1, c2) = (0, 0)
for i in range(len(s)):
	if s[i] == '(':
		f = 1
		if f:
			c2 = 0
			c1 += 1
			m1 = max(m1, c1)
		o.append(i + 1)
	else:
		f = 0
		c.append(i + 1)
		if f == 0:
			c1 = 0
			c2 += 1
			m2 = max(m2, c2)
ans1 = []
ans2 = []
while o and c:
	(a, b) = (o.pop(0), c.pop())
	if a < b:
		ans1.append(a)
		ans2.append(b)
	else:
		break
a = len(ans1) * 2
if a == 0:
	print(a)
	exit()
print(1, a, sep='\n')
print(*ans1, *sorted(ans2))


s = input()
l = len(s)
st = 0
end = l - 1
o = []
op = 0
while st < end:
	if s[st] == '(' and s[end] == ')':
		o.append(st + 1)
		o.append(end + 1)
		st += 1
		end -= 1
		op += 1
	else:
		if s[st] == ')':
			st += 1
		if s[end] == '(':
			end -= 1
if op == 0:
	print(0)
else:
	print(1)
	print(op * 2)
	for i in sorted(o):
		print(i, end=' ')


s = list(input())
count = 0
mode = 0
result = []
p1 = 0
p2 = len(s)
m = 0
while p1 < p2:
	if not mode:
		if s[p1] == '(':
			mode = 1
			p2 -= 1
		else:
			p1 += 1
	elif s[p2] == ')':
		mode = 0
		m += 1
		result.append(p1 + 1)
		result.append(p2 + 1)
		p1 += 1
	else:
		p2 -= 1
result.sort()
if m == 0:
	print(0)
else:
	print(1)
	print(m * 2)
	print(*result)


s = input()
ans = []
left = []
right = []
i = 0
j = len(s) - 1
l_found = 0
r_found = 0
while i < j:
	if s[i] == '(':
		l_save = i + 1
		l_found = 1
	if s[j] == ')':
		r_save = j + 1
		r_found = 1
	if l_found == 1 and r_found == 1:
		l_found = 0
		r_found = 0
		left.append(l_save)
		right.append(r_save)
		i += 1
		j -= 1
	elif l_found == 1 and r_found == 0:
		j -= 1
	elif l_found == 0 and r_found == 1:
		i += 1
	else:
		i += 1
		j -= 1
ans = left + right
ans.sort()
if len(ans) == 0:
	print(0)
else:
	print(1)
	print(len(ans))
	print(*ans)


s = input()
left = []
right = []
for i in range(len(s)):
	if s[i] == '(':
		left.append(i + 1)
	else:
		right.append(i + 1)
i = 0
j = len(right) - 1
left_sel = []
right_sel = []
while i < len(left) and j >= 0:
	if left[i] < right[j]:
		left_sel.append(left[i])
		right_sel.insert(0, right[j])
		i += 1
		j -= 1
	else:
		break
left_sel.extend(right_sel)
if len(left_sel) > 0:
	print(1)
	print(len(left_sel))
	print(*left_sel, sep=' ')
else:
	print(0)


s = input()
n = len(s)
done = {}
a = 0
f = []
while True:
	i = 0
	j = n - 1
	count = 0
	ans = []
	while i < j:
		while i < j and (i in done or s[i] != '('):
			i += 1
		while j > i and (j in done or s[j] != ')'):
			j -= 1
		if i == n or j == i:
			break
		else:
			done[i] = 1
			done[j] = 1
			ans.append(i + 1)
			ans.append(j + 1)
			count += 2
	if count == 0:
		break
	a += 1
	f.append(ans)
print(a)
for i in range(a):
	print(len(f[i]))
	print(*sorted(f[i]))


s = input()
start = 0
end = len(s) - 1
poslist = []
sequence = 0
while start < end:
	if s[start] == '(' and s[end] == ')':
		poslist.append(start + 1)
		poslist.append(end + 1)
		start += 1
		end -= 1
		sequence += 2
	elif s[start] == '(' and s[end] == '(':
		end -= 1
	elif s[start] == ')' and s[end] == ')':
		start += 1
	else:
		start += 1
		end -= 1
if sequence == 0:
	print('0')
else:
	print('1')
	print(sequence)
	poslist.sort()
	for y in poslist:
		print(y, end=' ')


seq = input()
ind = []
i = 0
j = len(seq) - 1
while i <= j:
	if seq[i] == '(':
		while j > i:
			if seq[j] == ')':
				ind.append(i + 1)
				ind.append(j + 1)
				j -= 1
				break
			j -= 1
	i += 1
ind.sort()
if len(ind) == 0:
	print('0')
else:
	print('1')
	print(len(ind))
	for val in ind:
		print(val, end=' ')


s = input()
n = len(s)
left = [0 for i in range(n)]
right = [0 for i in range(n)]
ct1 = 0
for i in range(n):
	if s[i] == '(':
		ct1 += 1
	left[i] = ct1
ct2 = 0
for i in range(n - 1, -1, -1):
	if s[i] == ')':
		ct2 += 1
	right[i] = ct2
val = 0
ix = -1
for i in range(n):
	if i + 1 < n and s[i] == '(':
		if min(left[i], right[i + 1]) > val:
			ix = i
		val = max(val, min(left[i], right[i + 1]))
if val == 0:
	print(0)
else:
	print(1)
	print(2 * val)
	ct = 0
	for i in range(ix + 1):
		if ct == val:
			break
		if s[i] == '(':
			ct += 1
			print(i + 1, end=' ')
	ct = 0
	lul = []
	for i in range(n - 1, -1, -1):
		if ct == val:
			break
		if s[i] == ')':
			ct += 1
			lul.append(i + 1)
	for c in lul[::-1]:
		print(c, end=' ')
	print()


s = input()
l = 0
r = len(s) - 1
res = []
cnt = 0
while l < r:
	if s[l] == '(':
		if s[r] == ')':
			res.append(l + 1)
			res.append(r + 1)
			cnt += 1
			l += 1
			r -= 1
		else:
			r -= 1
	else:
		l += 1
		if s[r] != ')':
			r -= 1
if cnt == 0:
	print(0)
else:
	print(1)
	print(2 * cnt)
	print(*sorted(res))


s = input()
(l, r) = ([], [])
for (i, c) in enumerate(s):
	if c == '(':
		l.append(i + 1)
	else:
		r.append(i + 1)
i = 0
while i < min(len(l), len(r)) and l[i] < r[-i - 1]:
	i += 1
if i == 0:
	print(0)
else:
	print(1)
	print(2 * i)
	print(' '.join([str(j) for j in l[:i] + r[-i:]]))


s = input()
i = 0
j = len(s) - 1
flag = 0
c = 0
li = []
while i < j:
	if s[i] == '(' and s[j] == ')':
		if flag == 0:
			c += 1
			flag = 1
		li.append(i + 1)
		li.append(j + 1)
		i += 1
		j -= 1
	else:
		if s[i] == ')':
			i += 1
		if s[j] == '(':
			j -= 1
print(c)
if c != 0:
	print(len(li))
	li.sort()
	print(*li)


ctr = 0
ans = []
inp = str(input())
ls = []
for a in inp:
	ls.append(a)
for i in range(len(ls)):
	if ls[i] == '(':
		for j in range(len(ls) - 1, i, -1):
			if ls[j] == ')' and j + 1 not in ans and (i + 1 not in ans):
				ans.append(i + 1)
				ans.append(j + 1)
				ctr += 2
				break
if ctr > 0:
	print('1')
print(ctr)
ans.sort()
for a in ans:
	print(a, end=' ')


st = list(input())
le = []
ri = []
for i in range(len(st)):
	if st[i] == '(':
		le.append(i + 1)
	else:
		ri.append(i + 1)
lle = len(le)
lri = len(ri)
if not le or not ri:
	print(0)
elif le[0] > ri[-1]:
	print(0)
else:
	count = 0
	li = []
	po = -1
	for i in range(lle):
		if le[i] > ri[po]:
			break
		else:
			count += 2
			li.append(le[i])
			li.append(ri[po])
			if lri + po != 0:
				po -= 1
			else:
				break
	li.sort()
	print(1)
	print(count)
	print(*li)


x = input()
n = len(x)
r = x.count(')')
a = []
p = 0
for i in range(n):
	if x[i] == '(':
		p += 1
		a.append(i + 1)
	else:
		r -= 1
	if p == r and r != 0:
		for t in range(i + 1, n):
			if x[t] == ')':
				a.append(t + 1)
		break
	elif p > r or p == r == 0:
		exit(print(0))
print(1, '\n', p * 2, sep='')
print(*a)


import sys

def input():
	return sys.stdin.readline()

def iinput():
	return int(input())

def rinput():
	return input().split()

def rlinput():
	return [int(i) for i in input().split()]

def main():
	s = list(input())
	n = len(s)
	res = []
	for i in range(len(s)):
		if s[i] == '(':
			while n > i:
				n -= 1
				if s[n] == ')':
					res.append(i + 1)
					res.append(n + 1)
					break
	if res:
		print('1\n' + str(len(res)) + '\n' + ' '.join(map(str, sorted(res))))
		return 0
	print(0)
for i in range(1):
	main()


s = input()
i = 0
j = len(s) - 1
op = 0
left = 0
right = 0
Ans = []
A = []
B = []
S = s[::-1]
t = len(s) - 1
for i in range(len(s)):
	if s[i] == '(':
		j = t
		A.append(i + 1)
		while j > i:
			if s[j] == ')':
				B.append(j + 1)
				j -= 1
				t = j
				break
			j -= 1
		if i >= j:
			break
if len(B) == 0:
	print(0)
else:
	print(1)
	print(2 * len(B))
	print(*A[:len(B)], end=' ')
	print(*sorted(B))


from collections import deque
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
s = input().replace('\n', '')
removed = set()
ans = []
while True:
	nxt_left = deque()
	nxt_right = deque()
	(l, r) = (0, len(s) - 1)
	while l < r:
		if l in removed or s[l] == ')':
			l += 1
		elif r in removed or s[r] == '(':
			r -= 1
		else:
			nxt_left.append(l + 1)
			nxt_right.appendleft(r + 1)
			removed.add(l)
			removed.add(r)
			l += 1
			r -= 1
	if len(nxt_left) == 0:
		break
	ans.append(list(nxt_left) + list(nxt_right))
print(len(ans))
for arr in ans:
	print(len(arr))
	print(' '.join(map(str, arr)))


s = input()
n = len(s)
ansc = []
for i in range(n):
	if i == 0:
		if s[i] == '(':
			c = [1]
			ansc.append(i)
		else:
			c = [0]
		continue
	if s[i] == '(':
		c.append(c[-1] + 1)
		ansc.append(i)
	else:
		c.append(c[-1])
anse = []
for i in range(n)[::-1]:
	if i == n - 1:
		if s[i] == ')':
			e = [1]
			anse.append(i)
		else:
			e = [0]
		continue
	if s[i] == ')':
		e.append(e[-1] + 1)
		anse.append(i)
	else:
		e.append(e[-1])
e.reverse()
m = []
for i in range(n):
	m.append(min(c[i], e[i]))
M = max(m)
if M == 0:
	print(0)
	exit()
print(1)
print(2 * M)
ansc = ansc[:M]
anse = anse[:M]
anse.reverse()
ans = ansc + anse
for j in range(2 * M):
	ans[j] += 1
print(' '.join(map(str, ans)))