// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <string>

using namespace std;

string specialtrim(string s)
{
   string res;
   for(int i = 0; i < s.length(); i++)
   {
      if(s[i] != ' ')
      {
          res += s[i];
      }
   }
   return res;
}

int main()
{
   string s = "linie 1  \n   linie2\n linie2 \n  ";
   cout << "#" << s << "#" << endl;
   string s2 = specialtrim(s);
   cout << "#" << s2 << "#" << endl;
   return 0;
}
