You are given a non-empty string s=s1s2…sns=s1s2…sn, 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 ss if there is an integer jj (1≤j≤n−21≤j≤n−2), that sjsj+1sj+2=sjsj+1sj+2=“one” or sjsj+1sj+2=sjsj+1sj+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=s=“onetwone”, then if Polycarp selects two indices 33 and 66, 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 tt (1≤t≤1041≤t≤104) — the number of test cases in the input. Next, the test cases are given.

Each test case consists of one non-empty string ss. Its length does not exceed 1.5⋅1051.5⋅105. The string ss 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⋅1061.5⋅106.

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

The first line of each answer should contain rr (0≤r≤|s|0≤r≤|s|) — the required minimum number of positions to be removed, where |s||s| is the length of the given line. The second line of each answer should contain rr different integers — the indices themselves for removal in any order. Indices are numbered from left to right from 11 to the length of the string. If r=0r=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”.
挺简单的一道题目。
三种情况:
①one,删除’n’即可。
②two,删除’w’即可。(这两种情况就可以避免最坏的情况发生)
③twone,删除’o’即可。
代码如下:

#include<bits/stdc++.h>
#define ll long long
using namespace std;string s;int main()
{int t;scanf("%d",&t);while(t--){cin>>s;int len=s.length();vector<int> p;for(int i=0;i<len;){if(s[i]=='o'&&s[i+1]=='n'&&s[i+2]=='e') p.push_back(i+2),i+=3;else if(s[i]=='t'&&s[i+1]=='w'&&s[i+2]=='o'){if(s[i+3]=='n'&&s[i+4]=='e') p.push_back(i+3),i+=5;else p.push_back(i+2),i+=3;}else i++;}cout<<p.size()<<endl;for(int i=0;i<p.size();i++) cout<<p[i]<<" ";cout<<endl;}return 0;
}

努力加油a啊,(o)/~

As Simple as One and Two(思维)相关推荐

  1. CodeForces - 1454E Number of Simple Paths(基环树+思维)

    题目链接:点击查看 题目大意:给出一棵 n 个点的基环树,现在需要求所有长度大于等于 1 的路径个数 题目分析:对于所有的路径 ( x , y ) 可以分成下列两种情况来考虑: 路径不会经过环上的边: ...

  2. 【HDU - 6237】A Simple Stone Game(贪心,思维,素因子分解,数学)

    题干: After he has learned how to play Nim game, Bob begins to try another stone game which seems much ...

  3. 爆刷PAT(甲级)——之【1148】 Werewolf - Simple Version(20 分)——思维

    之前考的时候想不到.今日抽空解决一下. 题意:N个人各指认一个人是好人还是坏人.其中有两个坏人,剩下的都是好人.而且必然是一个好人和一个坏人说的是谎话.给出他们互相指认的信息,请判断出哪两个是坏人.如 ...

  4. 更快学习 JavaScript 的 6 个思维技巧

    2019独角兽企业重金招聘Python工程师标准>>> 我们在学习JavaScript,或其他任何编码技能的时候,往往是因为这些拦路虎而裹足不前: 有些概念可能会造成混淆,尤其当你是 ...

  5. 压力测试即将开始,超前思维的128MB区块未必可行

    在过去的一段时间里,比特币现金(BCH)的开发者之一nChain不断的开发比特币SV代码库,在8月29日星期三,alpha版本正式发布,用以向矿工展示代码. 当前的alpha代码基于比特币ABC 17 ...

  6. 求职必备:如何用产品思维写简历

    确立优先级: 姓名,高,必不可少: 年龄,中,可有可无: 性别,低,公司禁止性别歧视,因此,此处无须标注. 照片,中,可有可无,正经的招聘方还是更看重能力,你长得漂亮,也只可能是加分项而已.(老板王思 ...

  7. 从Run Simple到Run Live,SAP有哪些新变化?

    2016年5月17-19日,SAPPHIRE NOW大会在美国佛罗里达州奥兰多市隆重举行.与往年不同,SAP CEO Bill McDermott 在今年的会议中多次提到一个新词,叫"Run ...

  8. Ehab and Path-etic MEXs CodeForces - 1325C(思维+贪心)

    You are given a tree consisting of n nodes. You want to write some labels on the tree's edges such t ...

  9. 数据科学的5种基本的面向业务的批判性思维技能

    批判性思维 As Alexander Pope said, to err is human. By that metric, who is more human than us data scient ...

最新文章

  1. EWS 通过SubscribeToPullNotifications订阅Exchange新邮件提醒
  2. protobuf扫盲
  3. 拷贝构造,深度拷贝,关于delete和default相关的操作,explicit,类赋初值,构造函数和析构函数,成员函数和内联函数,关于内存存储,默认参数,静态函数和普通函数,const函数,友元
  4. MS-SQL CLR 直接读写文件,飞一般的感觉!
  5. 日志分类存放_博特智能|文本智能聚类——千万日志一览无余
  6. python中random中uniform怎么用_Python中的random.uniform()函数教程与实例解析
  7. tomcat下配置ssl
  8. python控制mt4自动交易软件排名_股票自动交易软件排名
  9. HDOJ2027统计元音
  10. 逻辑斯蒂回归:家庭买私家车的概率
  11. 《python 编程从入门到实践》变量
  12. java 代码走查_Java代码走查具体考察点
  13. 怎么使用svn下载到本地
  14. 正则表达式系列之 —— 模式(Patterns)和修饰符(flags)
  15. DeFi新玩法丨一文教你玩转NFT碎片化协议Fractional
  16. 手把手带你免费打嘉立创pcb板
  17. vue实现简单搜索功能
  18. Python自动化开发从浅入深-进阶(script,dom,jquery 基础)
  19. pytorch忽略user warning
  20. jQuery Validate详解

热门文章

  1. IOS基础基于pod上手体验FMDB框架
  2. rpm如何卸载mysql_Linux下卸载和安装MySQL[rpm包]
  3. matlab算概率,用matlab计算概率,再次吐槽某些吧友国战比赛七框选将的建议
  4. Android studio删除sdk的方法(图文教程)
  5. Android中shape的解析
  6. Android系统自带样式(android:theme)
  7. u3d文件上传至服务器,unity 上传图片到云服务器
  8. python 抢购口罩_Python 京东口罩监控+抢购
  9. anaconda如何更改环境配置_Anaconda环境配置2020-08-27
  10. 每日Ubuntu小技巧 - 使用TeamViewer连接远程桌面