文章

101

粉丝

0

获赞

81

访问

4.8k

头像
字符分类 题解:
P1016 兰州大学/贵州大学机试题
发布于2026年1月30日 22:16
阅读数 40

#include<iostream>
#include<vector>
using namespace std;

string str;
string res1,res2,res3;

int main()
{
	cin>>str;
	for(int i=0;i<str.size();i++)
	{
		if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
			res1.push_back(str[i]);
		else if(str[i]>='0'&&str[i]<='9')
			res2.push_back(str[i]);
		else
			res3.push_back(str[i]);
	}
	cout<<res1<<endl;
	cout<<res2<<endl;
	cout<<res3<<endl;
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发