You are given a non-empty string $s=s_1s_2\dots s_n$, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string $s$ if there is an integer $j$ ($1 \le j \le n-2$), that $s_{j}s_{j+1}s_{j+2}=$"one" or $s_{j}s_{j+1}s_{j+2}=$"two".

For example:

  Polycarp does not like strings "oneee", "ontwow", "twone" and "oneonetwo" (they all have at least one substring "one" or "two"),  Polycarp likes strings "oonnee", "twwwo" and "twnoe" (they have no substrings "one" and "two"). 

Polycarp wants to select a certain set of indices (positions) and remove all letters on these positions. All removals are made at the same time.

For example, if the string looks like $s=$"onetwone", then if Polycarp selects two indices $3$ and $6$, then "onetwone" will be selected and the result is "ontwne".

What is the minimum number of indices (positions) that Polycarp needs to select to make the string liked? What should these positions be?


-----Input-----

The first line of the input contains an integer $t$ ($1 \le t \le 10^4$) — the number of test cases in the input. Next, the test cases are given.

Each test case consists of one non-empty string $s$. Its length does not exceed $1.5\cdot10^5$. The string $s$ consists only of lowercase Latin letters.

It is guaranteed that the sum of lengths of all lines for all input data in the test does not exceed $1.5\cdot10^6$.


-----Output-----

Print an answer for each test case in the input in order of their appearance.

The first line of each answer should contain $r$ ($0 \le r \le |s|$) — the required minimum number of positions to be removed, where $|s|$ is the length of the given line. The second line of each answer should contain $r$ different integers — the indices themselves for removal in any order. Indices are numbered from left to right from $1$ to the length of the string. If $r=0$, then the second line can be skipped (or you can print empty). If there are several answers, print any of them.


-----Examples-----
Input
4
onetwone
testme
oneoneone
twotwo

Output
2
6 3
0

3
4 1 7 
2
1 4

Input
10
onetwonetwooneooonetwooo
two
one
twooooo
ttttwo
ttwwoo
ooone
onnne
oneeeee
oneeeeeeetwooooo

Output
6
18 11 12 1 6 21 
1
1 
1
3 
1
2 
1
6 
0

1
4 
0

1
1 
2
1 11 



-----Note-----

In the first example, answers are:

  "onetwone",  "testme" — Polycarp likes it, there is nothing to remove,  "oneoneone",  "twotwo". 

In the second example, answers are:   "onetwonetwooneooonetwooo",  "two",  "one",  "twooooo",  "ttttwo",  "ttwwoo" — Polycarp likes it, there is nothing to remove,  "ooone",  "onnne" — Polycarp likes it, there is nothing to remove,  "oneeeee",  "oneeeeeeetwooooo".

Difficulty: MEDIUM
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
def main():
	t = int(input())
	s1 = 'one'
	s2 = 'two'
	for i in range(t):
		s = input()
		n = len(s)
		count = 0
		i = 2
		ans = []
		while i < n:
			s3 = s[i - 2:i + 1]
			if s3 == s1 or s3 == s2:
				count += 1
				if i + 2 < n and s[i:i + 3] == s1:
					ans.append(i + 1)
					i += 5
				else:
					ans.append(i)
					i += 2
			else:
				i += 1
		print(count)
		for i in range(len(ans)):
			print(ans[i], end=' ')
		print()
main()


for _ in range(int(input())):
	stro = list(input())
	ans = []
	for j in range(len(stro)):
		if j <= len(stro) - 5:
			if stro[j:j + 5] == ['t', 'w', 'o', 'n', 'e']:
				ans.append(j + 3)
				stro[j + 2] = '.'
		if j <= len(stro) - 3:
			if stro[j:j + 3] == ['t', 'w', 'o']:
				ans.append(j + 2)
				stro[j + 1] = '.'
		if j <= len(stro) - 3:
			if stro[j:j + 3] == ['o', 'n', 'e']:
				ans.append(j + 2)
				stro[j + 1] = '.'
	print(len(ans))
	print(*ans)


t = int(input())
for j in range(t):
	s = input()
	l = len(s)
	ans = 0
	A = []
	i = 0
	while i < l - 2:
		if s[i:i + 3] == 'one':
			ans += 1
			A.append(i + 2)
			i += 3
		elif s[i:i + 3] == 'two':
			ans += 1
			if i + 5 <= l and s[i + 2:i + 5] == 'one':
				A.append(i + 3)
				i += 5
			else:
				A.append(i + 2)
				i += 3
		else:
			i += 1
	print(ans)
	print(' '.join(list(map(str, A))))


t = int(input())
for ii in range(t):
	a = input()
	(num1, num2, num) = (0, 0, 0)
	ans = set()
	i = -1
	while 1:
		if i >= len(a) - 1:
			break
		i = a.find('one', i + 1)
		if i == -1:
			break
		if i > 0 and a[i - 1] == 'o':
			ans.add(i + 1)
		else:
			ans.add(i)
	i = -1
	while 1:
		if i >= len(a) - 1:
			break
		i = a.find('two', i + 1)
		if i == -1:
			break
		if i < len(a) - 3 and a[i + 3] == 'o':
			ans.add(i + 1)
		else:
			ans.add(i + 2)
	print(len(ans))
	for i in ans:
		print(i + 1, end=' ')
	print()


n = int(input())
for i in range(n):
	x = input()
	bfx = x.split('twone')
	x = list(x)
	res = []
	if len(bfx) > 0:
		last = 0
		for g in range(len(bfx) - 1):
			res.append(last + len(bfx[g]) + 3)
			last += len(bfx[g]) + 5
		x = list('tw-ne'.join(bfx))
	for g in range(len(x) - 2):
		if x[g:g + 3] == ['o', 'n', 'e'] or x[g:g + 3] == ['t', 'w', 'o']:
			x[g + 1] = '-'
			res.append(g + 2)
	print(len(res))
	print(*res)


for _ in range(int(input())):
	s = input()
	N = len(s)
	dp = [0] * (N + 1)
	for i in range(2, N):
		if s[i - 4:i + 1] == 'twone':
			dp[i - 2] = dp[i - 3]
			dp[i + 1] = dp[i]
		elif s[i - 2:i + 1] == 'one':
			dp[i] = dp[i - 1] + 1
			dp[i + 1] = dp[i]
		elif s[i - 2:i + 1] == 'two':
			dp[i] = dp[i - 1] + 1
			dp[i + 1] = dp[i]
		else:
			dp[i + 1] = dp[i]
	i = N
	res = list()
	print(dp[N])
	while dp[i] != 0:
		if dp[i - 1] != dp[i]:
			res.append(i)
		i -= 1
	print(*res)


def f():
	s = input()
	ans = [0] * len(s)
	i = 0
	cur = 0
	while i < len(s):
		sub = s[i:i + 3]
		if sub == 'one':
			ans[cur] = i + 1 + 1
			i = i + 3
			cur += 1
		elif sub == 'two':
			if s[i + 3:i + 5] == 'ne':
				ans[cur] = i + 2 + 1
				i = i + 5
			else:
				ans[cur] = i + 1 + 1
				i = i + 3
			cur += 1
		else:
			i += 1
	print(cur)
	print(*ans[:cur])
q = int(input())
for _ in range(q):
	f()


t = int(input())
for i in range(1, t + 1):
	a = []
	s = input()
	j = 0
	while j <= len(s) - 1:
		if s[j] == 'o':
			u = True
			if j >= 2:
				if s[j - 2] == 't' and s[j - 1] == 'w':
					if j <= len(s) - 2:
						if s[j + 1] == 'o':
							a.append(j)
						else:
							a.append(j + 1)
							u = False
					else:
						a.append(j)
			if j <= len(s) - 3:
				if s[j + 2] == 'e' and s[j + 1] == 'n':
					if u:
						a.append(j + 2)
					j += 3
				else:
					j += 1
			else:
				j += 1
		else:
			j += 1
	print(len(a))
	if len(a) != 0:
		print(*a)
	else:
		print()


t = int(input())
for i in range(t):
	s = list(input())
	ans = []
	for i in range(len(s) - 4):
		if s[i:i + 5] == ['t', 'w', 'o', 'n', 'e']:
			ans.append(i + 3)
			s[i + 2] = 'q'
	for i in range(len(s) - 2):
		if s[i:i + 3] == ['o', 'n', 'e'] or s[i:i + 3] == ['t', 'w', 'o']:
			ans.append(i + 2)
			s[i + 1] = 'q'
	print(len(ans))
	print(' '.join(map(str, ans)))


import re
n = int(input())
for i in range(n):
	s = input()
	ones = [m.start() for m in re.finditer('one', s)]
	twos = [m.start() + 2 for m in re.finditer('two', s)]
	onei = 0
	twoi = 0
	ans = []
	while onei < len(ones) or twoi < len(twos):
		if onei < len(ones) and twoi < len(twos) and (ones[onei] == twos[twoi]):
			ans.append(ones[onei])
			onei += 1
			twoi += 1
		elif onei == len(ones) or twoi == len(twos):
			if onei == len(ones):
				ans.append(twos[twoi] - 1)
				twoi += 1
			else:
				ans.append(ones[onei] + 1)
				onei += 1
		elif twos[twoi] < ones[onei]:
			ans.append(twos[twoi] - 1)
			twoi += 1
		else:
			ans.append(ones[onei] + 1)
			onei += 1
	print(len(ans))
	for an in ans:
		print(an + 1, end=' ')
	print()


import sys
input = lambda : sys.stdin.readline()
for i in range(int(input())):
	one = 0
	two = 0
	twone = 0
	s = list(input())
	i = 0
	ind = []
	while i < len(s) - 4:
		if s[i] == 't' and s[i + 1] == 'w' and (s[i + 2] == 'o') and (s[i + 3] == 'n') and (s[i + 4] == 'e'):
			twone += 1
			ind.append(i + 3)
			i += 5
		elif s[i] == 'o' and s[i + 1] == 'n' and (s[i + 2] == 'e'):
			one += 1
			ind.append(i + 2)
			i += 3
		elif s[i] == 't' and s[i + 1] == 'w' and (s[i + 2] == 'o'):
			two += 1
			ind.append(i + 2)
			i += 3
		else:
			i += 1
	while i < len(s) - 2:
		if s[i] == 'o' and s[i + 1] == 'n' and (s[i + 2] == 'e'):
			one += 1
			ind.append(i + 2)
			i += 3
		elif s[i] == 't' and s[i + 1] == 'w' and (s[i + 2] == 'o'):
			two += 1
			ind.append(i + 2)
			i += 3
		else:
			i += 1
	print(one + two + twone)
	print(*ind)


for i in range(int(input())):
	s = input()
	arr = []
	for j in range(len(s)):
		if s[j] == 'o':
			if j > 1 and j < len(s) - 2 and (s[j + 1] == 'n') and (s[j + 2] == 'e') and (s[j - 1] == 'w') and (s[j - 2] == 't'):
				arr.append(j + 1)
			elif j > 1 and s[j - 1] == 'w' and (s[j - 2] == 't') and (j == len(s) - 1 or s[j + 1] != 'o'):
				arr.append(j + 1)
			elif j > 1 and s[j - 1] == 'w' and (s[j - 2] == 't') and (j != len(s) - 1) and (s[j + 1] == 'o'):
				arr.append(j)
			elif j < len(s) - 2 and s[j + 1] == 'n' and (s[j + 2] == 'e') and (j == 0 or s[j - 1] != 'o'):
				arr.append(j + 1)
			elif j < len(s) - 2 and s[j + 1] == 'n' and (s[j + 2] == 'e') and (j != 0) and (s[j - 1] == 'o'):
				arr.append(j + 2)
	print(len(arr))
	print(*arr)


t = int(input())
for _ in range(t):
	s = input()
	l = len(s)
	r = set()
	for i in range(l - 2):
		if s[i] == 'o':
			if s[i + 1] == 'n':
				if s[i + 2] == 'e':
					if i > 0:
						if s[i - 1] != 'w':
							r.add(i + 2)
						else:
							r.add(i + 1)
					else:
						r.add(i + 1)
		elif s[i] == 't':
			if s[i + 1] == 'w':
				if s[i + 2] == 'o':
					if i + 3 < l:
						if s[i + 3] != 'n':
							r.add(i + 2)
						else:
							r.add(i + 3)
					else:
						r.add(i + 2)
	print(len(r))
	for el in r:
		print(el, end=' ')
	print()


for __ in range(int(input())):
	ar = list(input())
	ans = []
	x = len(ar)
	for i in range(x - 4):
		if ar[i] + ar[i + 1] + ar[i + 2] + ar[i + 3] + ar[i + 4] == 'twone':
			ans.append(i + 3)
	for j in range(x - 4):
		if ar[j] + ar[j + 1] + ar[j + 2] == 'two' and ar[j + 3] + ar[j + 4] != 'ne':
			ans.append(j + 2)
		if ar[j + 2] + ar[j + 3] + ar[j + 4] == 'one' and ar[j] + ar[j + 1] != 'tw':
			ans.append(j + 4)
	if x > 2:
		if ar[x - 3] + ar[x - 2] + ar[x - 1] == 'two':
			ans.append(x - 1)
	if x > 3:
		if ar[x - 4] + ar[x - 3] + ar[x - 2] == 'two':
			ans.append(x - 2)
	if x > 2:
		if ar[0] + ar[1] + ar[2] == 'one':
			ans.append(2)
	if x > 3:
		if ar[1] + ar[2] + ar[3] == 'one':
			ans.append(3)
	print(len(ans))
	print(' '.join(map(str, ans)))


n = int(input())
Ans = []
for j in range(n):
	Ans_0 = []
	s = input()
	len_s = len(s)
	s = list(s)
	for i in range(2, len_s):
		S = s[i - 2] + s[i - 1] + s[i]
		if i < len_s - 2:
			if S + s[i + 1] + s[i + 2] == 'twone':
				Ans_0.append(i + 1)
			elif S == 'one' or S == 'two':
				if Ans_0:
					if Ans_0[-1] != i - 1:
						Ans_0.append(i)
				else:
					Ans_0.append(i)
		elif S == 'one' or S == 'two':
			if Ans_0:
				if Ans_0[-1] != i - 1:
					Ans_0.append(i)
			else:
				Ans_0.append(i)
	Ans.append(Ans_0)
for i in range(len(Ans)):
	print(len(Ans[i]))
	print(*Ans[i])


t = int(input())
for i in range(t):
	re = []
	s = str(input())
	l = len(s)
	for j in range(l - 4):
		if s[j:j + 5] == 'twone':
			re.append(j + 2)
		elif s[j:j + 3] == 'two':
			re.append(j + 1)
		elif s[j:j + 3] == 'one':
			if j >= 2:
				if s[j - 2:j + 3] != 'twone':
					re.append(j + 1)
			else:
				re.append(j + 1)
	if (s[l - 4:l - 1] == 'one' or s[l - 4:l - 1] == 'two') and s[l - 6:-1] != 'twone':
		re.append(l - 3)
	if (s[l - 3:] == 'one' or s[l - 3:] == 'two') and s[l - 5:] != 'twone':
		re.append(l - 2)
	le = len(re)
	print(le)
	for d in range(le):
		print(re[d] + 1, end=' ')
	print()


for q in range(int(input())):
	s = input()
	ans = 0
	i = 0
	j = 0
	ans = []
	while i < len(s) - 1:
		if i + 4 < len(s) and s[i:i + 5] == 'twone':
			ans.append(i + 3)
			i += 4
		elif i + 2 < len(s) and s[i:i + 3] == 'two':
			ans.append(i + 2)
			i += 2
		elif i + 2 < len(s) and s[i:i + 3] == 'one':
			ans.append(i + 2)
			i += 2
		i += 1
	print(len(ans))
	for e in ans:
		print(e, end=' ')
	print()


import sys
import math

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

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

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

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

def rlinput():
	return list(rinput())

def main():
	(res1, res2, res12, o, res) = (0, 0, 0, 0, [])
	s = list(input())
	n = len(s) - 2
	while o < n - 2:
		if s[o] == 't' and s[o + 1] == 'w' and (s[o + 2] == 'o') and (s[o + 3] == 'n') and (s[o + 4] == 'e'):
			res12 += 1
			res.append(o + 3)
			o += 5
		elif s[o] == 'o' and s[o + 1] == 'n' and (s[o + 2] == 'e'):
			res1 += 1
			res.append(o + 2)
			o += 3
		elif s[o] == 't' and s[o + 1] == 'w' and (s[o + 2] == 'o'):
			res2 += 1
			res.append(o + 2)
			o += 3
		else:
			o += 1
	while o < n:
		if s[o] == 'o' and s[o + 1] == 'n' and (s[o + 2] == 'e'):
			res1 += 1
			res.append(o + 2)
			o += 3
		elif s[o] == 't' and s[o + 1] == 'w' and (s[o + 2] == 'o'):
			res2 += 1
			res.append(o + 2)
			o += 3
		else:
			o += 1
	print(res1 + res2 + res12)
	print(*res)
for i in range(iinput()):
	main()


t = int(input())
for _ in range(t):
	s = input()
	a = []
	n = len(s)
	if s.count('two') + s.count('one') == 0:
		ans = 0
	else:
		ans = 0
		for i in range(n):
			if i + 4 < n:
				if s[i:i + 5] == 'twone':
					ans += 1
					a.append(str(i + 3))
				elif i + 2 < n:
					if s[i:i + 3] == 'one' and s[i - 2:i + 3] != 'twone' or s[i:i + 3] == 'two':
						ans += 1
						a.append(str(i + 2))
			elif i + 2 < n:
				if s[i:i + 3] == 'one' and s[i - 2:i + 3] != 'twone' or s[i:i + 3] == 'two':
					ans += 1
					a.append(str(i + 2))
	print(ans)
	print(' '.join(a))


n = int(input())
for _ in range(n):
	s = input()
	ans = []
	i = 0
	while i < len(s):
		if s[i:i + 3] == 'one':
			ans.append(i + 1)
			i += 3
		elif s[i:i + 3] == 'two':
			if s[i:i + 5] == 'twone':
				ans.append(i + 2)
				i += 5
			else:
				ans.append(i + 1)
				i += 3
		else:
			i += 1
	print(len(ans))
	print(' '.join(list(map(lambda x: str(x + 1), ans))))


for _ in range(int(input())):
	s = input()
	a = []
	i = 0
	while i <= len(s) - 1:
		if s[i:i + 5] == 'twone':
			a.append(i + 3)
			i += 5
		elif s[i] == 'o' and s[i:i + 3] == 'one':
			a.append(i + 2)
			i += 3
		elif s[i] == 't' and s[i:i + 3] == 'two':
			a.append(i + 2)
			i += 3
		else:
			i += 1
	print(len(a))
	if len(a) == 0:
		print('')
	else:
		print(*a)


def main():
	t = int(input())
	for i in range(t):
		s = input()
		const = len(s)
		ans = set()
		i = 0
		while i < const:
			if i + 4 < const:
				if s[i:i + 5] == 'twone':
					ans.add(str(i + 3))
					i += 3
				elif i + 2 < const:
					if s[i:i + 3] == 'one':
						ans.add(str(i + 2))
					if s[i:i + 3] == 'two':
						ans.add(str(i + 2))
			elif i + 2 < const:
				if s[i:i + 3] == 'one':
					ans.add(str(i + 2))
				if s[i:i + 3] == 'two':
					ans.add(str(i + 2))
			i += 1
		print(len(ans))
		print(' '.join(ans))
main()


import math
t = int(input())
for j in range(t):
	a = list(input())
	res = ''
	k = 0
	i = 0
	while i < len(a) - 2:
		if a[i] == 'o':
			if a[i + 1] == 'n':
				if a[i + 2] == 'e':
					if i + 3 < len(a) and a[i + 3] != 'e':
						res += str(i + 3) + ' '
						k += 1
					else:
						res += str(i + 2) + ' '
						k += 1
					i += 2
		if a[i] == 't':
			if a[i + 1] == 'w':
				if a[i + 2] == 'o':
					if i + 3 < len(a) and a[i + 3] != 'o':
						res += str(i + 3) + ' '
						k += 1
					else:
						res += str(i + 2) + ' '
						k += 1
					i += 2
		i += 1
	print(k)
	print(res)


for _ in range(int(input())):
	i = 0
	z = input()
	ans = []
	while i + 2 < len(z):
		if z[i] == 't' and z[i + 1] == 'w' and (z[i + 2] == 'o'):
			if i < len(z) - 4 and z[i + 3] == 'n' and (z[i + 4] == 'e'):
				ans.append(i + 3)
				i += 5
			else:
				ans.append(i + 2)
				i += 3
		elif z[i] == 'o' and z[i + 1] == 'n' and (z[i + 2] == 'e'):
			ans.append(i + 2)
			i += 3
		else:
			i += 1
	print(len(ans))
	print(*ans)


t = int(input())
for i in range(t):
	s = input()
	indexes = []
	j = 0
	while j < len(s) - 2:
		if s[j] == 'o' and s[j + 1] == 'n' and (s[j + 2] == 'e'):
			indexes.append(j + 1 + 1)
			j += 2
		elif s[j] == 't' and s[j + 1] == 'w' and (s[j + 2] == 'o'):
			if j + 3 < len(s) and s[j + 3] == 'n':
				indexes.append(j + 2 + 1)
				j += 3
			else:
				indexes.append(j + 1 + 1)
				j += 2
		j += 1
	print(len(indexes))
	print(*indexes)


t = int(input())
for i in range(t):
	s = input()
	ans = []
	for i in range(1, len(s) - 1):
		if s[i] == 'w' and s[i - 1] == 't' and (s[i + 1] == 'o') and (i + 3 < len(s)) and (s[i + 2] == 'n') and (s[i + 3] == 'e'):
			ans.append(i + 1 + 1)
		elif s[i] == 'n' and s[i - 1] == 'o' and (s[i + 1] == 'e') and (len(ans) == 0 or ans[len(ans) - 1] != i):
			ans.append(i + 1)
		elif s[i] == 'w' and s[i - 1] == 't' and (s[i + 1] == 'o'):
			ans.append(i + 1)
	print(len(set(ans)))
	print(*list(set(ans)))


t = int(input())
for j in range(t):
	n = list(input())
	r = 0
	ans = []
	for i in range(len(n) - 2):
		if len(n) - 4 > i and n[i] == 't' and (n[i + 1] == 'w') and (n[i + 2] == 'o') and (n[i + 3] == 'n') and (n[i + 4] == 'e'):
			r += 1
			ans.append(i + 3)
			n[i + 2] = '#'
		elif n[i] == 'o' and n[i + 1] == 'n' and (n[i + 2] == 'e') or (n[i] == 't' and n[i + 1] == 'w' and (n[i + 2] == 'o')):
			r += 1
			ans.append(i + 2)
			n[i + 1] = '#'
	print(r)
	print(*ans)


k = int(input())

def pandora(v):
	if len(v) < 3:
		print(0)
		return
	if len(v) == 3:
		if v[0] == 'o' and v[1] == 'n' and (v[2] == 'e') or (v[0] == 't' and v[1] == 'w' and (v[2] == 'o')):
			print('1\n1')
			return
	q = 0
	z = []
	v.append('h')
	for i in range(3, len(v)):
		if v[i - 3] == 'o' and v[i - 2] == 'n' and (v[i - 1] == 'e'):
			q += 1
			z.append(i - 2 + 1)
		if v[i - 3] == 't' and v[i - 2] == 'w' and (v[i - 1] == 'o'):
			if v[i] == 'o':
				q += 1
				z.append(i - 2 + 1)
			else:
				q += 1
				z.append(i - 1 + 1)
				v[i - 1] = 'q'
	print(q)
	print(' '.join(list([str(x) for x in z])))
for _ in range(k):
	pandora(list(input()))


t = int(input())
for i in range(t):
	indexes = set()
	s = input()
	for j in range(len(s) - 2):
		if s[j:j + 3] == 'two':
			if j != len(s) - 3:
				if s[j + 3] != 'o':
					indexes.add(j + 3)
				else:
					indexes.add(j + 2)
			else:
				indexes.add(j + 2)
		elif s[j:j + 3] == 'one':
			if j == 0 or s[j - 1] != 'o':
				indexes.add(j + 1)
			else:
				indexes.add(j + 2)
	print(len(indexes))
	print(*indexes)


t = int(input())
for i in range(0, t):
	s = input()
	bal = 0
	a = []
	n = len(s)
	for j in range(0, n):
		if s[j] == 'o':
			bal = 1
		elif bal == 1 and s[j] == 'n':
			bal += 1
		elif bal == 2 and s[j] == 'e':
			bal = 0
			a.append([j - 2, j, 1])
		else:
			bal = 0
	bal = 0
	for j in range(0, n):
		if s[j] == 't':
			bal = 1
		elif bal == 1 and s[j] == 'w':
			bal += 1
		elif bal == 2 and s[j] == 'o':
			bal = 0
			a.append([j - 2, j, 2])
		else:
			bal = 0
	a.sort()
	ans = []
	length = len(a)
	if length == 0:
		print(0)
		print('')
	else:
		if a[0][2] == 1:
			if not (a[0][0] - 1 >= 0 and s[a[0][0] - 1] == 'o'):
				ans.append(a[0][0] + 1)
			else:
				ans.append(a[0][0] + 2)
		elif not (a[0][1] + 1 < n and s[a[0][1] + 1] == 'o'):
			ans.append(a[0][1] + 1)
		else:
			ans.append(a[0][1])
		for j in range(1, length):
			if a[j][2] == 1:
				if a[j][0] != a[j - 1][1]:
					if not (a[j][0] - 1 >= 0 and s[a[j][0] - 1] == 'o'):
						ans.append(a[j][0] + 1)
					else:
						ans.append(a[j][0] + 2)
			elif not (a[j][1] + 1 < n and s[a[j][1] + 1] == 'o'):
				ans.append(a[j][1] + 1)
			else:
				ans.append(a[j][1])
		print(len(ans))
		print(*ans)


def main():
	t = int(input())
	for i in range(t):
		s = input()
		c = 0
		idx = []
		for j in range(len(s)):
			if s[j] == 'o':
				if j > 1 and j < len(s) - 2:
					if s[j - 2:j] == 'tw' and s[j + 1:j + 3] == 'ne':
						idx.append(j + 1)
						c += 1
					elif s[j + 1:j + 3] == 'ne':
						idx.append(j + 2)
						c += 1
					elif s[j - 2:j] == 'tw':
						idx.append(j)
						c += 1
				elif j < len(s) - 2:
					if s[j + 1:j + 3] == 'ne':
						idx.append(j + 2)
						c += 1
				elif j > 1:
					if s[j - 2:j] == 'tw':
						idx.append(j)
						c += 1
		print(c)
		for j in range(len(idx)):
			if j != len(idx) - 1:
				print(idx[j], end=' ')
			else:
				print(idx[j])
main()


t = int(input())
for i in range(t):
	a = input()
	an = 0
	nm = []
	if len(a) > 2:
		v = 2
		if a[v - 2] + a[v - 1] + a[v] == 'one':
			an += 1
			nm.append(v)
		if a[v - 2] + a[v - 1] + a[v] == 'two':
			an += 1
			nm.append(v)
	if len(a) > 3:
		v = 3
		if a[v - 2] + a[v - 1] + a[v] == 'one':
			an += 1
			nm.append(v)
		if a[v - 2] + a[v - 1] + a[v] == 'two':
			an += 1
			nm.append(v)
	for v in range(4, len(a)):
		if a[v - 4] + a[v - 3] + a[v - 2] + a[v - 1] + a[v] == 'twone':
			if len(nm) != 0:
				nm.pop()
			else:
				an += 1
			nm.append(v - 1)
		elif a[v - 2] + a[v - 1] + a[v] == 'one':
			an += 1
			nm.append(v)
		if a[v - 2] + a[v - 1] + a[v] == 'two':
			an += 1
			nm.append(v)
	print(an)
	print(*nm, sep=' ')


t = int(input())
for i in range(t):
	s = input()
	(one, twone) = (0, 0)
	a = []
	for j in range(len(s)):
		st = s[j]
		if twone == 0 and st == 't':
			twone = 1
		elif twone == 1 and st == 'w':
			twone = 2
		elif twone == 2 and st == 'o':
			twone = 3
		elif twone == 3 and st == 'n':
			twone = 4
		elif twone == 4 and st == 'e':
			twone = 5
		else:
			if twone == 5:
				a.append(j - 2)
			elif twone >= 3:
				a.append(j - twone + 2)
			twone = 0
			if st == 't':
				twone = 1
		if twone != 3:
			if one == 0 and st == 'o':
				one = 1
			elif one == 1 and st == 'n':
				one = 2
			elif one == 2 and st == 'e':
				one = 3
			else:
				if one == 3:
					a.append(j - 1)
				one = 0
				if st == 'o':
					one = 1
	if twone == 5:
		a.append(j - 1)
	elif twone >= 3:
		a.append(j - twone + 4)
	if one == 3:
		a.append(j)
	print(len(a))
	print(*a)


t = int(input())
for i in range(t):
	cnt = 0
	a = []
	s = input()
	j = 0
	while j < len(s) - 2:
		if j < len(s) - 4 and s[j:j + 5] == 'twone':
			a.append(j + 2 + 1)
			cnt += 1
			j += 5
			continue
		elif s[j:j + 3] == 'one' or s[j:j + 3] == 'two':
			a.append(j + 1 + 1)
			cnt += 1
			j += 3
			continue
		j += 1
	print(cnt)
	print(*a)


t = int(input())
ans = []
for _ in range(t):
	s = input()
	p = []
	i = 0
	n = len(s)
	while i + 3 <= n:
		if i + 5 <= n and s[i:i + 5] == 'twone':
			p.append(i + 3)
			i += 5
		elif s[i:i + 3] == 'one':
			p.append(i + 2)
			i += 3
		elif s[i:i + 3] == 'two':
			p.append(i + 2)
			i += 3
		else:
			i += 1
	ans.append(p.copy())
for a in ans:
	print(len(a))
	print(' '.join(list(map(str, a))))


t = int(input())
for i in range(t):
	s = input()
	one = set()
	two = set()
	cnt = 0
	ans = []
	for i in range(len(s) - 2):
		if s[i:i + 3] == 'one':
			one.add(i + 1)
		elif s[i:i + 3] == 'two':
			two.add(i + 1)
	both = set()
	for i in one:
		if i - 2 in two:
			both.add(i)
	print(len(one) + len(two) - len(both))
	for i in both:
		print(i, end=' ')
	for i in one:
		if not i in both:
			print(i + 1, end=' ')
	for i in two:
		if not i + 2 in both:
			print(i + 1, end=' ')
	print()


a = int(input())
for i in range(a):
	g = input()
	p = 0
	one = str('one')
	two = str('two')
	ch = []
	for i in range(len(g) - 2):
		if g[i] == 'o':
			if g[i + 1] == 'n':
				if g[i + 2] == 'e':
					if p == 0:
						ch.append(i + 2)
					else:
						p = 0
		if g[i] == 't':
			if g[i + 1] == 'w':
				if g[i + 2] == 'o':
					if len(g) - 1 >= i + 4:
						if g[i + 3] == 'n' and g[i + 4] == 'e':
							ch.append(i + 3)
							p = 1
						else:
							ch.append(i + 2)
					else:
						ch.append(i + 2)
	print(len(ch))
	print(*ch)


t = int(input())
ans = []
for i in range(t):
	s = input()
	ans.append([])
	if len(s) > 2:
		j = 0
		while j < len(s) - 2:
			if j < len(s) - 4 and s[j:j + 5] == 'twone':
				ans[-1].append(j + 3)
				j += 4
			elif s[j:j + 3] == 'two':
				ans[-1].append(j + 2)
				j += 1
			elif s[j:j + 3] == 'one':
				ans[-1].append(j + 2)
				j += 1
			else:
				j += 1
for i in ans:
	print(len(i))
	print(*i)


t = int(input())
for i in range(t):
	stroka = 'cc' + input() + 'cc'
	s = list(stroka)
	r = 0
	indexes = []
	for j in range(len(s)):
		if s[j] == 'o':
			if s[j + 1] == 'n' and s[j + 2] == 'e':
				if s[j - 1] == 'o':
					indexes.append(j)
				else:
					indexes.append(j - 1)
				r += 1
			elif s[j - 1] == 'w' and s[j - 2] == 't':
				if s[j + 1] == 'o':
					indexes.append(j - 2)
				else:
					indexes.append(j - 1)
				r += 1
	print(r)
	print(*indexes)


t = int(input())
for _ in range(t):
	s = input()
	len_s = len(s)
	ans = [0, []]
	for i in range(len_s):
		if s[i] == 'o':
			if i >= 2 and s[i - 1] == 'w' and (s[i - 2] == 't') and (i + 2 < len_s) and (s[i + 1] == 'n') and (s[i + 2] == 'e'):
				ans[0] += 1
				ans[1].append(i + 1)
			elif i >= 2 and s[i - 1] == 'w' and (s[i - 2] == 't'):
				ans[0] += 1
				ans[1].append(i)
			elif i + 2 < len_s and s[i + 1] == 'n' and (s[i + 2] == 'e'):
				ans[0] += 1
				ans[1].append(i + 2)
	print(ans[0])
	print(*ans[1])


t = int(input())
for i in range(0, t):
	j = 0
	r = input()
	d = len(r)
	s = []
	while j < d - 2:
		if r[j] == 'o' and r[j + 1] == 'n' and (r[j + 2] == 'e'):
			s.append(j + 2)
			j += 3
		elif r[j] == 't' and r[j + 1] == 'w' and (r[j + 2] == 'o'):
			if j < d - 4 and r[j + 3] == 'n' and (r[j + 4] == 'e'):
				s.append(j + 3)
				j += 5
			else:
				s.append(j + 2)
				j += 3
		else:
			j += 1
	print(len(s))
	print(*s)


t = int(input())
for _ in range(t):
	s = input()
	i = 0
	ans = []
	n = len(s)
	while True:
		if i + 1 + 1 >= n:
			break
		if s[i] + s[i + 1] + s[i + 2] == 'one':
			ans.append(i + 1)
			i += 3
		elif s[i] + s[i + 1] + s[i + 2] == 'two':
			if i + 4 < n:
				if s[i + 2] + s[i + 3] + s[i + 4] == 'one':
					ans.append(i + 2)
					i += 5
				else:
					ans.append(i + 1)
					i += 3
			else:
				ans.append(i + 1)
				i += 3
		else:
			i += 1
	print(len(ans), sep='', end='')
	print()
	for i in ans:
		print(i + 1, sep='', end=' ')
	print()


t = int(input())
strings = [input() for _ in range(t)]
for string in strings:
	n = len(string)
	ans = string.count('one') + string.count('two') - string.count('twone')
	print(ans)
	i = 0
	f = True
	answers = []
	while i < n - 2:
		if string[i:i + 3] == 'one':
			answers.append(i + 2)
			i += 3
			continue
		elif i < n - 4 and string[i:i + 5] == 'twone':
			answers.append(i + 3)
			i += 5
			continue
		elif string[i:i + 3] == 'two':
			answers.append(i + 2)
			i += 3
			continue
		i += 1
	print(*answers)


t = int(input())
for i in range(t):
	s = input()
	c = 0
	m = []
	j = 0
	while j < len(s) - 4:
		if s[j] == 't' and s[j + 1] == 'w' and (s[j + 2] == 'o') and (s[j + 3] == 'n') and (s[j + 4] == 'e'):
			c += 1
			m.append(j + 3)
			j += 5
		elif s[j] == 't' and s[j + 1] == 'w' and (s[j + 2] == 'o') or (s[j] == 'o' and s[j + 1] == 'n' and (s[j + 2] == 'e')):
			m.append(j + 2)
			c += 1
			j += 3
		else:
			j += 1
	while j < len(s) - 2:
		if s[j] == 't' and s[j + 1] == 'w' and (s[j + 2] == 'o') or (s[j] == 'o' and s[j + 1] == 'n' and (s[j + 2] == 'e')):
			m.append(j + 2)
			c += 1
			j += 3
		else:
			j += 1
	print(c)
	for j in m:
		print(j, end=' ')
	print()


def check_string(string):
	indexes = get_matches(string)
	length = len(indexes)
	print(length)
	print(' '.join(indexes))

def get_matches(string):
	indexes = []
	for index in range(0, len(string) - 2):
		check_fragment = string[index:index + 3]
		is_one = check_fragment == 'one'
		if is_one:
			one_start = string[index - 2:index]
			if one_start != 'tw':
				indexes.append(str(index + 2))
		else:
			is_two = check_fragment == 'two'
			if is_two:
				check_fragment = string[index:index + 5]
				is_twone = check_fragment == 'twone'
				if is_twone:
					indexes.append(str(index + 3))
				else:
					indexes.append(str(index + 2))
	return indexes
for i in range(int(input())):
	c = input()
	check_string(c)


t = int(input())
for i in range(t):
	s = input()
	sy = 0
	A = set()
	for j in range(len(s) - 2):
		if s[j] + s[j + 1] + s[j + 2] == 'one':
			if s[j - 1] == 'o':
				A.add(j + 1)
			else:
				A.add(j)
		elif s[j] + s[j + 1] + s[j + 2] == 'two':
			if j < len(s) - 3 and s[j + 3] == 'o':
				A.add(j + 1)
			else:
				A.add(j + 2)
	print(len(A))
	for j in A:
		print(j + 1, end=' ')
	print()


t = int(input())
for _ in range(t):
	poz = []
	x = input()
	i = 1
	d = len(x)
	while i < d - 1:
		q = x[i]
		if q == 'n':
			if x[i - 1] == 'o' and x[i + 1] == 'e':
				poz.append(i + 1)
		if q == 'w':
			if x[i - 1] == 't' and x[i + 1] == 'o':
				poz.append(i + 1)
		if i > 1 and i < d - 2 and (q == 'o'):
			if x[i - 2] == 't' and x[i + 2] == 'e' and (x[i - 1] == 'w') and (x[i + 1] == 'n'):
				poz[-1] = i + 1
				i += 1
		i += 1
	print(len(poz))
	print(*poz)


t = int(input())
for r in range(t):
	q = input()
	o = [w for w in range(len(q)) if q[w] in 'nw']
	e = []
	for w in o:
		if q[w - 1:w + 2] in ['two', 'one']:
			e += [[w, 1]]
	e.sort()
	for w in range(len(e) - 1):
		if e[w][0] + 2 == e[w + 1][0]:
			e[w][0] += 1
			e[w + 1][1] = 0
	e = [w[0] + 1 for w in e if w[1]]
	print(len(e))
	print(*e)


t = int(input())
for i in range(t):
	s = input()
	x = len(s)
	(f1, f2, fl3) = (False, False, False)
	j = 0
	cnt = 0
	res = []
	colo = 0
	while j < x:
		if j + 2 <= x:
			if s[j:j + 3] == 'two':
				if j + 3 < x:
					if s[j + 3] == 'o':
						res.append(j + 2)
						j += 2
					else:
						res.append(j + 3)
						j += 3
				else:
					res.append(j + 3)
					j += 3
				cnt += 1
			elif s[j:j + 3] == 'one':
				if colo > 0:
					res.append(j + 2)
					colo = 0
				else:
					res.append(j + 1)
				cnt += 1
				j += 3
			else:
				if s[j] == 'o':
					colo += 1
				j += 1
		else:
			break
	print(cnt)
	print(*res)


t = int(input())
for g in range(0, t):
	s = input()
	i = 0
	n = len(s)
	ans = []
	while i < n - 2:
		if s[i:i + 3] == 'two':
			if s[i + 2:i + 5] == 'one':
				ans += [i + 2 + 1]
				i += 5
			else:
				ans += [i + 1 + 1]
				i += 3
		elif s[i:i + 3] == 'one':
			ans += [i + 1 + 1]
			i += 3
		else:
			i += 1
	print(len(ans))
	print(*ans)


def zf(s):
	n = len(s)
	z = [0] * n
	z[0] = n
	l = 0
	r = 0
	for i in range(1, n):
		if i <= r:
			z[i] = min(r - i + 1, z[i - l])
		while i + z[i] < n and s[z[i]] == s[i + z[i]]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
t = int(input())
for i in range(t):
	s = input()
	ban1 = 'one'
	ban2 = 'two'
	ban21 = 'twone'
	s1 = ban1 + 'A' + s
	s2 = ban2 + 'A' + s
	s21 = ban21 + 'A' + s
	c = 0
	l = len(s)
	z1 = zf(s1)
	z2 = zf(s2)
	z21 = zf(s21)
	ans = []
	i = 0
	while i < l:
		if z21[i + 6] == 5:
			c += 1
			ans.append(i + 3)
			i += 5
			continue
		if z1[i + 4] == 3:
			c += 1
			ans.append(i + 2)
			i += 3
			continue
		if z2[i + 4] == 3:
			c += 1
			ans.append(i + 2)
			i += 3
			continue
		i += 1
	print(c)
	print(*ans)