Advertisement
jusohatam

Untitled

Oct 7th, 2020
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     ifstream f;
  9.     f.open("input.txt", ios::in);
  10.     string s;
  11.     while (getline(f, s)) {
  12.         for (size_t i = 0; i < s.size(); ++i) {
  13.             if(isdigit(s[i])) {
  14.                 cout << s[i];
  15.             } else if (s[i] == ' ') {
  16.                 cout << " ";
  17.             }
  18.         }
  19.         cout << " ";
  20.     }
  21.     f.close();
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement