Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ifstream cin("input.txt");
  10.     ofstream cout("output.txt");
  11.     const char r = ' ';
  12.     const string z(",.!?");
  13.     string s;
  14.     string str;
  15.     while(getline(cin, str))
  16.     {
  17.         s += str + ' ';
  18.     }
  19.     if(s.length() && s[0] == r)
  20.         s.erase(0, s.find_first_not_of(r));
  21.  
  22.     cout << s;
  23.     cin.close();
  24.     cout.close();
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement