Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- std::string FilterString(const std::string&);
- int main()
- {
- std::string s;
- std::cin >> s;
- std::cout << FilterString(s) << std::endl;
- return 0;
- }
- std::string FilterString(const std::string& s)
- {
- std::string out;
- for (char ch : s)
- if ('0' <= ch && ch <= '9')
- out += ch;
- return out;
- }
Advertisement
Add Comment
Please, Sign In to add comment