#include <iostream>#include <string>using namespace std;void trim(string& s) { while ((!s.empty()) && (*s.begin()==' ')) s.erase(s.begin()); while ((!s.empty()) && (*s.rbegin()==' ')) s.erase(s.end()-1);}int main() { string s(" test me "); trim(s); cout<<"|"<<s<<"|"<<endl; return 0;}