将奇数位置取出来即可:
while i<s.size()
str+=s[i]
i+=2
c++:
#include <bits/stdc++.h>
using namespace std;
int main(){
int T=0;
cin>>T;
while(T!=0){
string str;
cin>>str;
vector<char> tmp;
for(int i=0;i<str.size();i+=2){
tmp.push_back(str.at(i));
}
string res(tmp.begin(),tmp.end());
cout<<res<<endl;
T--;
}
}