题解 | #合并符串#

合并符串

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

#include <iostream>
using namespace std;

int main() {
    string a,b;
    string res;
    cin>>a>>b;
    int x=0,y=b.size()-1;
    for(int i=0; i<a.size(); i++){
        res.append(1,a[x++]);
        res.append(1,b[y--]);
    }
    cout<<res;
}

全部评论

相关推荐

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