Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. /*
  2.  
  3. Nasha rozpovid pro yizhachka
  4. Pro malenkogo necluhnanogo,
  5.  
  6. Yak spitkala malogo bida
  7. Vzhe ne zhvavogo ne rumyanogo.
  8.  
  9. V temnim lisi bagato prygod
  10. Ptahy, ravlyky, ckunsy, oleni,
  11.  
  12. Ta chomus potyagnulo yogo
  13. Na dorizhenku acphaltovanu.
  14.  
  15.  
  16. YYIIZZHHAACCHHOOKK!!
  17. Pidnimus, pidberys!
  18.  
  19. YYIIZZHHAACCHHOOKK!!
  20. Razom z namy posmihnys!
  21.  
  22. YYIIZZHHAACCHHOOKK!!
  23. Navkrugy, ozernys!
  24.  
  25. YYIIZZHHAACCHHOOKK!!
  26. YYIIZZHHAACCHHOOKK!!
  27.  
  28. */
  29.  
  30. #include <bits/stdc++.h>
  31.  
  32. using namespace std;
  33.  
  34. #define fast ios_base::sync_with_stdio();cin.tie();cout.tie();
  35. #define ops cout<<"ops"<<endl;
  36. #define fi first
  37. #define se second
  38.  
  39. typedef long long ll;
  40. typedef unsigned long long ull;
  41. typedef long double ld;
  42. typedef pair<ll,ll> pllll;
  43. typedef string str;
  44. typedef char cr;
  45.  
  46. const ll DIM=150007;
  47. const ll DIMM=2e4+7;
  48. const ll INF=1e18+7;
  49. const ll X=3e5;
  50. const ll MODULO=1000000007;
  51.  
  52. ll nt;
  53. ll n;
  54. str s;
  55. pair<cr,ll> a[DIM];
  56. ll c,res,ind[DIM];
  57.  
  58. int main()
  59. {
  60. //freopen("input.txt","r",stdin);
  61. fast;
  62. //ll x1,y1,x2,y2;
  63.  
  64. cin>>nt;
  65. while(nt--)
  66. {
  67.  
  68. cin>>s;
  69. n=s.length();
  70.  
  71. if(n<3)
  72. {
  73. cout<<0<<endl;
  74. cout<<endl;
  75. continue;
  76. }
  77.  
  78. if(n==3)
  79. {
  80. if(s=="one" || s=="two")
  81. {
  82. cout<<1<<endl;
  83. cout<<1<<endl;
  84. }
  85. else
  86. {
  87. cout<<0<<endl;
  88. cout<<endl;
  89. }
  90. continue;
  91. }
  92.  
  93. c=0;
  94. res=0;
  95.  
  96. c++;
  97. a[c]= {s[0],0};
  98. c++;
  99. a[c]= {s[1],1};
  100.  
  101. for(int i=2; i<(n-2); i++)
  102. {
  103. if(s[i-2]=='t' && s[i-1]=='w' && s[i+1]=='n' && s[i+2]=='e')
  104. {
  105. res++;
  106. ind[res]=i+1;
  107. }
  108. else
  109. {
  110. c++;
  111. a[c]= {s[i],i};
  112. }
  113. }
  114.  
  115. c++;
  116. a[c]= {s[n-2],n-2};
  117. c++;
  118. a[c]= {s[n-1],n-1};
  119.  
  120. for(int i=2; i<=(c-1); i++)
  121. {
  122. 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'))
  123. {
  124. res++;
  125. ind[res]=a[i].se+1;
  126. }
  127. }
  128. cout<<res<<endl;
  129. for(int i=1; i<=res; i++)cout<<ind[i]<<' ';
  130. cout<<endl;
  131. }
  132. return 0;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement