文章
84
粉丝
408
获赞
141
访问
939.8k
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	string sstr = "", snum = "", sother = "";//存字符、数字和其他字符 
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] >= 'a' && s[i] <= 'z' || s[i] >= 'A' && s[i] <= 'Z')
			sstr += s[i];
		else if (s[i] >= '0' && s[i] <= '9')
			snum += s[i];
		else
			sother += s[i];
	}
	cout << sstr << endl;
	cout << snum << endl;
	cout << sother << endl;
	return 0;
}
登录后发布评论
暂无评论,来抢沙发