题解 | #合并符串#

合并符串

https://www.nowcoder.com/practice/7f436c901a0d450ebdec1168e3e57cc2

#include<iostream>
#include<string>
using namespace std;
int main(){
	string str1, str2;
	while (cin >> str1 >> str2){
		string ans;
		for (int i = 0; i < str1.size(); i++){
			ans.insert(ans.size(), 1, str1[i]);
			ans.insert(ans.size(), 1, str2[str2.size()-1-i]);
		}
		cout << ans << endl;
	}
}

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务