-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_one_two.py
executable file
·40 lines (40 loc) · 1.07 KB
/
code_one_two.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
tot_input = int(input())
arr_input = []
for i in range(tot_input):
arr_input.append(raw_input())
tot_rem_per = []
ind_rem_per = []
for i in range(tot_input):
j = 0
count = 0
index = []
while True :
if arr_input[i][j:j+5] == 'twone' and j<=len(arr_input[i])-5:
count += 1
index.append(j+2)
j=j+4
elif arr_input[i][j:j+3]=='one':
count += 1
if arr_input[i][j-1]=='o' and j!=0:
index.append(j+1)
else:
index.append(j)
j = j+2
elif arr_input[i][j:j+3]=='two':
if arr_input[i][j-1]=='t' and j!=0:
index.append(j+1)
else :
index.append(j)
count += 1
j = j+2
if j <= len(arr_input[i])-4:
j =j+1
else :
break
tot_rem_per.append(count)
ind_rem_per.append(index)
for i in range(tot_input):
print(tot_rem_per[i])
for j in range(len(ind_rem_per[i])):
print(ind_rem_per[i][j]+1),
print('')