题解 | #字符串连接#

字符串连接

http://www.nowcoder.com/practice/40d83e5509b04d20825ae68fe35e9ca8

#include using namespace std;

int main(){ string s, r; getline(cin, s); for(int i = 0; i < s.size(); i++){ while(s[i] == ' ') i++; if(s[i] != ' '){ r.append(s, i, 1); } } cout << r; return 0; }

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务