#include<iostream> #include<string> using namespace std; void findnum(string & ch); bool isnum(char n); int main() { string m ; cout << "Enter a string:\n";
while (cin>>m&&cin.get() != '\n');
findnum(m); return 0; }
void findnum(string & ch) { int k = ch.size(); int * num = new int[k]; int result; int n = 0; int i = 0; while (n<k) { result = 0; if (isnum(ch[n])) { result = ch[n] - '0'; while (n<k&&isnum(ch[++n])) result = (ch[n] - '0') + 10 * result; num[i++] = result; } ++n; } for (int j = 0; j <i; ++j) cout << num[j] << "\t";; }