Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string str, digits, letters, other;
- cin >> str;
- for (int i = 0; i < str.length(); i++) {
- if (isdigit(str[i])) {
- digits += str[i];
- }
- else if (isalpha(str[i])) {
- letters += str[i];
- }
- else {
- other += str[i];
- }
- }
- cout << digits << endl
- << letters << endl
- << other << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement