字符分类 题解:
#include<iostream>
using namespace std;
int main() {
string s;
getline(cin, s);
string num, alp, other;
for (auto c : s) {
if (isdigit(c)) num += c;
else if (isalpha(c)) alp += c;
else other += c;
}
cout << alp << endl << num << endl << other << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发