文章

19

粉丝

67

获赞

29

访问

11.8k

头像
字符串加法
P1012 贵州大学机试题
发布于2023年8月11日 09:59
阅读数 504

#include <bits/stdc++.h>

using namespace std;

int main()
{
	string s;
	string digits;
	string nd;
	cin >> s;
	for (auto i = s.begin(); i != s.end(); i++)
	{
		if (isdigit(*i))
		{
			digits.push_back(*i);
		}
		else
		{
			nd.push_back(*i);
		}
	}
	cout << nd + digits;
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发