版权声明:虽然我依旧蒟蒻,但请你尊重我 :D ——陈杉菜 https://blog.csdn.net/qq_44702847/article/details/89303014
H-分离
链接:https://ac.nowcoder.com/acm/contest/558/H
来源:牛客网
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
题目描述
小猫在研究字符串。
小猫在研究奇数的性质。
给定一个字符串S,请你输出将其奇数位的字符提出来以后得到的字符串。
输入描述:
第一行一个正整数T,表示数据组数。接下来T行,每行一个字符串S,表示每组数据。
输出描述:
T行,每行一个字符串,表示每组数据的答案。
示例1
输入
2
abcdefg
ababab
输出
aceg
aaa
备注:
1≤T,|S|≤100
大声bb
我相信这是好水的题,嗯,完。
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctype.h>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<list>
#include<fstream>
using namespace std;
typedef long long ll;
int main(){
int t;
cin>>t;
while(t--){
string s;
char ans[110]={0};
cin>>s;
int index=0;
for(int i=0;i<s.length();i+=2){
ans[index++]=s[i];
}
cout<<ans<<endl;
}
return 0;
}