1276A. As Simple as One and Two
生活随笔
收集整理的這篇文章主要介紹了
1276A. As Simple as One and Two
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
A. As Simple as One and Two:題目
思路:刪去中間 #include <bits/stdc++.h> using namespace std; #define int long long vector<int> a((int)6e5); vector<int> b((int)6e5), c((int)6e5); const int mod = 1e9 + 7; string s; signed main() {int t;cin>>t;while (t--){int cnt = 0;cin>>s;int n = s.length();for (int i=0;i<n-2;i++){if((s[i]=='t'&&s[i+1]=='w'&&s[i+2]=='o'&&s[i+3]=='n'&&s[i+4]=='e')){s[i+2]='%';a[cnt++] = i+3;}else if((s[i]=='t'&&s[i+1]=='w'&&s[i+2]=='o')||(s[i]=='o'&&s[i+1]=='n'&&s[i+2]=='e')){s[i+1] ='%';a[cnt++] = i+2;}}cout<<cnt<<endl;for (int i=0;i<cnt;i++) cout<<a[i]<<" ";cout<<endl;} }總結
以上是生活随笔為你收集整理的1276A. As Simple as One and Two的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 1560F1. Nearest Beau
- 下一篇: 再次细分防火墙 WebRAY为何定义MA