#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
using namespace std;

int main() {

    stringstream myfile{"hello124\t4\nzxA23\n2\nz"};
    
    if (myfile) { //if file is open then
        string line; 
        while(getline(myfile, line)){ //while succesful read
                            //remove all chars, special and whitespace
            line.erase(remove_if(line.begin(), line.end(), [](const char& c) { return !isdigit(c); } ), line.end()); 
            cout << line<<endl; // then write the line in the output file 
        }
   }
    else{
        cout << "Error in opening file" << endl;
    }
        return 0;
}