Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Nasha rozpovid pro yizhachka
- Pro malenkogo necluhnanogo,
- Yak spitkala malogo bida
- Vzhe ne zhvavogo ne rumyanogo.
- V temnim lisi bagato prygod
- Ptahy, ravlyky, ckunsy, oleni,
- Ta chomus potyagnulo yogo
- Na dorizhenku acphaltovanu.
- YYIIZZHHAACCHHOOKK!!
- Pidnimus, pidberys!
- YYIIZZHHAACCHHOOKK!!
- Razom z namy posmihnys!
- YYIIZZHHAACCHHOOKK!!
- Navkrugy, ozernys!
- YYIIZZHHAACCHHOOKK!!
- YYIIZZHHAACCHHOOKK!!
- */
- #include <bits/stdc++.h>
- using namespace std;
- #define fast ios_base::sync_with_stdio();cin.tie();cout.tie();
- #define ops cout<<"ops"<<endl;
- #define fi first
- #define se second
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef pair<ll,ll> pllll;
- typedef string str;
- typedef char cr;
- const ll DIM=150007;
- const ll DIMM=2e4+7;
- const ll INF=1e18+7;
- const ll X=3e5;
- const ll MODULO=1000000007;
- ll nt;
- ll n;
- str s;
- pair<cr,ll> a[DIM];
- ll c,res,ind[DIM];
- int main()
- {
- //freopen("input.txt","r",stdin);
- fast;
- //ll x1,y1,x2,y2;
- cin>>nt;
- while(nt--)
- {
- cin>>s;
- n=s.length();
- if(n<3)
- {
- cout<<0<<endl;
- cout<<endl;
- continue;
- }
- if(n==3)
- {
- if(s=="one" || s=="two")
- {
- cout<<1<<endl;
- cout<<1<<endl;
- }
- else
- {
- cout<<0<<endl;
- cout<<endl;
- }
- continue;
- }
- c=0;
- res=0;
- c++;
- a[c]= {s[0],0};
- c++;
- a[c]= {s[1],1};
- for(int i=2; i<(n-2); i++)
- {
- if(s[i-2]=='t' && s[i-1]=='w' && s[i+1]=='n' && s[i+2]=='e')
- {
- res++;
- ind[res]=i+1;
- }
- else
- {
- c++;
- a[c]= {s[i],i};
- }
- }
- c++;
- a[c]= {s[n-2],n-2};
- c++;
- a[c]= {s[n-1],n-1};
- for(int i=2; i<=(c-1); i++)
- {
- if((a[i-1].fi=='o' && a[i].fi=='n' && a[i+1].fi=='e') || (a[i-1].fi=='t' && a[i].fi=='w' && a[i+1].fi=='o'))
- {
- res++;
- ind[res]=a[i].se+1;
- }
- }
- cout<<res<<endl;
- for(int i=1; i<=res; i++)cout<<ind[i]<<' ';
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement